== User Login ==== Actors: **Registered User (USER / ADMIN / INSTRUCTOR)** **1.** Check if User Exists.”. The system checks whether a user with the given email exists in the database. {{{#!sql SELECT id, password, role FROM user_entity WHERE email = :email; }}} **2.** Password Validation (Application Logic). **#** The entered password is compared with the stored hashed password. **#** If the password is invalid, the login process is stopped. **#** If the password is valid, the process continues. **3.** Load User Type Based on Role. After successful authentication, the system loads the user type according to the role. **#** If the role is USER: {{{#!sql SELECT id FROM users WHERE id = :userId; }}} **#** If the role is ADMIN: {{{#!sql SELECT id FROM administrators WHERE id = :userId; }}} **#** If the role is INSTRUCTOR: {{{#!sql SELECT id FROM instructors WHERE id = :userId; }}}