Skip to content

Commit

Permalink
prevent the user from going back to the login page after successful a…
Browse files Browse the repository at this point in the history
…uthentication
  • Loading branch information
shukebeta committed May 28, 2024
1 parent 440e938 commit fc8795e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/screens/login_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ class LoginController {

if (apiResponse['successful']) {
// Navigate to the home page
navigator.push(
navigator.pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => HomePage()),
(route) => false,
);
} else {
// Show error message if login fails
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/registration_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ class RegistrationController {
if (apiResponse['successful']) {
scaffoldContext.showSnackBar(
const SnackBar(content: Text('Registration successful')));
navigator.push(
navigator.pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => HomePage()),
(route) => false,
);
} else {
scaffoldContext
Expand Down

0 comments on commit fc8795e

Please sign in to comment.