= UseCase002 - Logging in as user **Initiating actor:** Logged-Out User {{{#!div style="text-align: justify; width: 100%;" The goal of this use case is to allow an existing user to authenticate their identity and gain access to their personalized account features. The system verifies the provided credentials against the stored records in the User table to establish a secure session. Successful authentication enables the user to act as a Logged-In Consumer or Logged-In Admin depending on their account type. }}} == Scenario {{{#!div style="text-align: justify; width: 100%;" 1. User enters their email and password into the login interface and submits the form. 2. System retrieves the user record from the database to verify the credentials and determine the user's role. {{{#!div style="margin-left: 20px;" {{{ SELECT user_id, email, password FROM USERS WHERE email = 'user@example.com'; }}} }}} 3. System checks the Admin and Consumer tables to identify the specific permissions and attributes associated with that user_id. {{{#!div style="margin-left: 20px;" {{{ SELECT user_id, points_collected FROM CONSUMERS WHERE user_id = :authenticated_user_id; SELECT user_id, type, discount_percentage FROM ADMINS WHERE user_id = :authenticated_user_id; }}} }}} 4. System grants access and redirects the user to the appropriate dashboard based on the results. }}}