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 {
|
public void signOutUser() throws AuthException {
|
||||||
authSession = null;
|
authSession = null;
|
||||||
|
email = null;
|
||||||
|
password = null;
|
||||||
waiting = true;
|
waiting = true;
|
||||||
Amplify.Auth.signOut(this::signOutSuccess, error -> setAuthError(error));
|
Amplify.Auth.signOut(this::signOutSuccess, error -> setAuthError(error));
|
||||||
throwIfAuthError();
|
throwIfAuthError();
|
||||||
|
|||||||
@ -210,6 +210,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
am.signOutUser();
|
am.signOutUser();
|
||||||
Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
|
Intent intent = new Intent(MainActivity.this, com.example.listify.ui.LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.example.listify.MainActivity;
|
||||||
import com.example.listify.R;
|
import com.example.listify.R;
|
||||||
import static com.example.listify.MainActivity.am;
|
import static com.example.listify.MainActivity.am;
|
||||||
|
|
||||||
@ -25,6 +26,11 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_forgotpswd);
|
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 = (Button) findViewById(R.id.button1);
|
||||||
button1.setOnClickListener(new View.OnClickListener() {
|
button1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -70,6 +76,7 @@ public class ForgotPasswordPage extends AppCompatActivity implements CodePage.Co
|
|||||||
am.confirmPasswordReset(newPassword, code);
|
am.confirmPasswordReset(newPassword, code);
|
||||||
Intent intent = new Intent(ForgotPasswordPage.this, LoginPage.class);
|
Intent intent = new Intent(ForgotPasswordPage.this, LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
|||||||
@ -25,6 +25,11 @@ public class LoginPage extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_login);
|
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 = (Button) findViewById(R.id.button1);
|
||||||
button1.setOnClickListener(new View.OnClickListener() {
|
button1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -57,6 +62,7 @@ public class LoginPage extends AppCompatActivity {
|
|||||||
am.signIn(email, password);
|
am.signIn(email, password);
|
||||||
Intent intent = new Intent(LoginPage.this, MainActivity.class);
|
Intent intent = new Intent(LoginPage.this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
|||||||
@ -28,6 +28,11 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_signup);
|
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 = (Button) findViewById(R.id.button1);
|
||||||
button1.setOnClickListener(new View.OnClickListener() {
|
button1.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -83,6 +88,7 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
|
|||||||
am.signIn(email, password);
|
am.signIn(email, password);
|
||||||
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
Intent intent = new Intent(SignupPage.this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
|||||||
@ -60,6 +60,7 @@ public class HomeFragment extends Fragment {
|
|||||||
am.deleteUser(requestor);
|
am.deleteUser(requestor);
|
||||||
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Log.i("Authentication", e.toString());
|
Log.i("Authentication", e.toString());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user