mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 02:38:47 +00:00
User can now log out and also automatically gets logged in after signing up
This commit is contained in:
parent
8dd2f33b42
commit
fdf27b9e62
@ -19,6 +19,10 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
||||
private Button button1; //Log in page button
|
||||
private Button button2; //Sign up button
|
||||
|
||||
String email;
|
||||
String password;
|
||||
String confirmPassword;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -41,9 +45,9 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
||||
EditText passwordText = (EditText) findViewById(R.id.editTextTextPassword);
|
||||
EditText confirmPasswordText = (EditText) findViewById(R.id.editTextTextPassword2);
|
||||
|
||||
String email = emailText.getText().toString();
|
||||
String password = passwordText.getText().toString();
|
||||
String confirmPassword = confirmPasswordText.getText().toString();
|
||||
email = emailText.getText().toString();
|
||||
password = passwordText.getText().toString();
|
||||
confirmPassword = confirmPasswordText.getText().toString();
|
||||
|
||||
if(!password.equals(confirmPassword)) {
|
||||
TextView invalidCred = findViewById(R.id.textView3);
|
||||
@ -76,7 +80,8 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
||||
if(!cancel) {
|
||||
try {
|
||||
am.confirmSignUp(code);
|
||||
Intent intent = new Intent(SignupPage.this, LoginPage.class);
|
||||
am.signIn(email, password);
|
||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@ -39,6 +39,12 @@ public class HomeFragment extends Fragment {
|
||||
toLoginPage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
am.signOutUser();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("Authentication", e.toString());
|
||||
}
|
||||
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
@ -68,7 +74,6 @@ public class HomeFragment extends Fragment {
|
||||
}
|
||||
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||
am.deleteUser(requestor);
|
||||
|
||||
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:text="Log in"
|
||||
android:text="Log out"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user