source: docs/P4-Prototype/UseCase0002Implementation.md@ fe28254

main
Last change on this file since fe28254 was b715712, checked in by Stefan <trsunovstefan@…>, 8 weeks ago

Add the server side and configuration

  • Property mode set to 100644
File size: 981 bytes
Line 
1# Use-case 0002 Implementation — Log in
2
3**Initiating actor:** Visitor. **Source file:** `server/auth.go`, function `Login` + `authenticate`.
4
5## Scenario (implemented)
6
71. **User** chooses option `[2] Login`.
8
9
102. **System** prompts for username and password.
11
123. **User** enters `alice` / `test123`.
13
144. **System** looks up the user and compares hashes:
15
16 ```sql
17 SELECT id, password_hash FROM users WHERE username = $1;
18 ```
19
20 The Go side (`authenticate` in `server/auth.go`) compares the returned `password_hash` against `sha256hex(entered_password)`.
21
225. **System** on success stores `{UserID, Username}` in the in-process `Session` and shows the authenticated menu.
23
24 ![A rejected login followed by a successful one](screenshots/uc0002_login.png)
25
26## Seed credentials
27
28| Username | Password | Balance |
29|----------|----------|---------|
30| `alice` | `test123` | 10000.00 USD |
31| `bob` | `test123` | 5000.00 USD |
32| `charlie` | `test123` | 2500.00 USD |
Note: See TracBrowser for help on using the repository browser.