= UseCase02 - Doctor Login / Authentication = == Initiating Actor - `Doctor` == == Description == A doctor logs into the Medora healthcare system using their username and password. The system verifies the credentials, checks that the account is active, retrieves the doctor's profile with department and specialization, and grants access to the doctor's portal. == Scenario == 1. Doctor navigates to the Medora login page. 2. Doctor enters their username and password and submits the login form. {{{ #!sql SELECT u.user_id, u.username, u.password, u.role, u.first_name, u.last_name, u.is_active FROM users u WHERE u.username = 'elena.kirova'; }}} 3. System verifies the account is active and the password matches. {{{ #!sql SELECT u.user_id FROM users u WHERE u.username = 'elena.kirova' AND u.is_active = TRUE; }}} 4. System retrieves the linked doctor profile with specialization and department. {{{ #!sql SELECT d.doctor_id, d.specialization, dep.name AS department_name, u.first_name, u.last_name, u.email FROM doctors d JOIN departments dep ON d.department_id = dep.department_id JOIN users u ON d.user_id = u.user_id WHERE d.user_id = (SELECT user_id FROM users WHERE username = 'elena.kirova'); }}} 5. Doctor is authenticated and redirected to their dashboard.