Skip to content

Login screen remains in navigation stack causing Back-Button Session Leak #1056

Description

@vibhutomer

Description

In login_page.dart, the navigation logic successfully routes the user to the DashBoardTabletView upon authentication. However, it utilizes Navigator.of(context).push() instead of a replacement method.

Because .push() simply layers the new route on top of the existing one, the LoginPage remains active in the navigation stack. If an authenticated user presses the Android hardware Back button from the Dashboard, they are incorrectly routed back to the Login screen, breaking the session UX and creating an illogical app flow.

Steps to Reproduce

  1. Launch the application and navigate to the Login screen.
  2. Authenticate successfully to reach the Dashboard.
  3. Press the physical hardware Back button on the Android device/emulator.
  4. Observe that the app routes back to the Login screen instead of exiting the app or acting on the Dashboard's back-press logic.

Expected Behavior

Once a user authenticates and navigates to the core application (Dashboard), the Login screen should be completely removed from the navigation stack. Pressing the Back button from the root Dashboard should either prompt the user to exit the app or do nothing, but it should never return to the Login screen.

Environment

  • Target File: lib/ui/login_page.dart

Proposed Solution

Replace the Navigator.of(context).push(...) call with Navigator.of(context).pushReplacement(...) (or pushAndRemoveUntil if there are multiple pre-login routes) to ensure the authentication screens are destroyed upon successful login.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions