| | 1 | = UseCase02 - Doctor Login / Authentication = |
| | 2 | |
| | 3 | == Initiating Actor - `Doctor` == |
| | 4 | |
| | 5 | |
| | 6 | == Description == |
| | 7 | 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. |
| | 8 | |
| | 9 | == Scenario == |
| | 10 | |
| | 11 | 1. Doctor navigates to the Medora login page. |
| | 12 | |
| | 13 | 2. Doctor enters their username and password and submits the login form. |
| | 14 | |
| | 15 | {{{ |
| | 16 | #!sql |
| | 17 | SELECT |
| | 18 | u.user_id, |
| | 19 | u.username, |
| | 20 | u.password, |
| | 21 | u.role, |
| | 22 | u.first_name, |
| | 23 | u.last_name, |
| | 24 | u.is_active |
| | 25 | FROM users u |
| | 26 | WHERE u.username = 'elena.kirova'; |
| | 27 | }}} |
| | 28 | |
| | 29 | 3. System verifies the account is active and the password matches. |
| | 30 | |
| | 31 | {{{ |
| | 32 | #!sql |
| | 33 | SELECT u.user_id |
| | 34 | FROM users u |
| | 35 | WHERE u.username = 'elena.kirova' |
| | 36 | AND u.is_active = TRUE; |
| | 37 | }}} |
| | 38 | |
| | 39 | 4. System retrieves the linked doctor profile with specialization and department. |
| | 40 | |
| | 41 | {{{ |
| | 42 | #!sql |
| | 43 | SELECT |
| | 44 | d.doctor_id, |
| | 45 | d.specialization, |
| | 46 | dep.name AS department_name, |
| | 47 | u.first_name, |
| | 48 | u.last_name, |
| | 49 | u.email |
| | 50 | FROM doctors d |
| | 51 | JOIN departments dep ON d.department_id = dep.department_id |
| | 52 | JOIN users u ON d.user_id = u.user_id |
| | 53 | WHERE d.user_id = (SELECT user_id FROM users WHERE username = 'elena.kirova'); |
| | 54 | }}} |
| | 55 | |
| | 56 | 5. Doctor is authenticated and redirected to their dashboard. |