mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
User can no longer reaccess login-required pages through the back button
This commit is contained in:
parent
465318eb84
commit
f62e666652
@ -156,6 +156,8 @@ public class AuthManager {
|
||||
|
||||
public void signOutUser() throws AuthException {
|
||||
authSession = null;
|
||||
email = null;
|
||||
password = null;
|
||||
waiting = true;
|
||||
Amplify.Auth.signOut(this::signOutSuccess, error -> setAuthError(error));
|
||||
throwIfAuthError();
|
||||
|
||||
@ -210,6 +210,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
||||
am.signOutUser();
|
||||
Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("Authentication", e.toString());
|
||||
|
||||
@ -8,6 +8,7 @@ import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.listify.MainActivity;
|
||||
import com.example.listify.R;
|
||||
import static com.example.listify.MainActivity.am;
|
||||
|
||||
@ -25,6 +26,11 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_forgotpswd);
|
||||
|
||||
if(am.getEmail() != null) {
|
||||
Intent intent = new Intent(ForgotPasswordPage.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
button1 = (Button) findViewById(R.id.button1);
|
||||
button1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -70,6 +76,7 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
||||
am.confirmPasswordReset(newPassword, code);
|
||||
Intent intent = new Intent(ForgotPasswordPage.this, LoginPage.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("Authentication", e.toString());
|
||||
|
||||
@ -25,6 +25,11 @@ public class LoginPage extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
if(am.getEmail() != null) {
|
||||
Intent intent = new Intent(LoginPage.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
button1 = (Button) findViewById(R.id.button1);
|
||||
button1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -57,6 +62,7 @@ public class LoginPage extends AppCompatActivity {
|
||||
am.signIn(email, password);
|
||||
Intent intent = new Intent(LoginPage.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
catch(Exception e) {
|
||||
Log.i("Authentication", e.toString());
|
||||
|
||||
@ -28,6 +28,11 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_signup);
|
||||
|
||||
if(am.getEmail() != null) {
|
||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
button1 = (Button) findViewById(R.id.button1);
|
||||
button1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -83,6 +88,7 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
||||
am.signIn(email, password);
|
||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("Authentication", e.toString());
|
||||
|
||||
@ -60,6 +60,7 @@ public class HomeFragment extends Fragment {
|
||||
am.deleteUser(requestor);
|
||||
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
||||
startActivity(intent);
|
||||
getActivity().finish();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i("Authentication", e.toString());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user