source: docs/P4-Prototype/UseCase0001Implementation.md@ df05838

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

Add the server side and configuration

  • Property mode set to 100644
File size: 1.2 KB
Line 
1# Use-case 0001 Implementation — Register
2
3**Initiating actor:** Visitor. **Source file:** `server/auth.go`, function `Register`.
4
5## Scenario (implemented)
6
71. **User** chooses option `[1] Register` from the anonymous menu.
8
9
102. **System** prompts for username, email, full name and password (`server/auth.go:20-23`).
11
123. **User** enters the values.
13
144. **System** validates (empty checks, `@` in email, ≥ 6 chars in password) and then asks the database:
15
16 ```sql
17 SELECT EXISTS(
18 SELECT 1 FROM users WHERE username = $1 OR email = $2
19 );
20 ```
21
22
235. **System** inserts the new row (password hashed in Go, not in SQL, to keep hashing identical between register and login):
24
25 ```sql
26 INSERT INTO users (username, email, full_name, password_hash, available_balance)
27 VALUES ($1, $2, $3, $4, 0);
28 ```
29
306. **System** confirms: `Account created. You can now log in.`
31
32 ![Registering a new account](screenshots/uc0001_register.png)
33
34## How to reproduce
35
36```sh
37./eduberza -init # optional: reset to a known state
38./eduberza
39# choose [1] Register, then enter username / email / full name / password
40```
41
42The screenshot above is from an actual run: registering `marko` /
43`marko@example.com`, followed by the confirmation line.
Note: See TracBrowser for help on using the repository browser.