source: docs/P3-UseCaseModel/UseCase0001.md@ 8b447ef

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

Add the server side and configuration

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[d8ce4e2]1# Use-case 0001 — Register new account
2
3**Initiating actor:** Visitor
4
5**Other actors:** —
6
7A new person creates an account on EduBerza so they can later log in as a Trader. The system validates input, refuses duplicates, and stores a hashed password.
8
9## Scenario
10
111. Visitor chooses "Register" from the anonymous menu.
122. System prompts for username, email, full name and password.
133. Visitor enters values.
144. System validates:
15 - username, email, password are non-empty.
16 - email contains `@`.
17 - password is at least 6 characters.
185. System checks whether the chosen username or email already exists:
19
20 ```sql
21 SELECT EXISTS (
22 SELECT 1 FROM project.users
23 WHERE username = $1 OR email = $2
24 );
25 ```
266. If the row exists, system informs the user and the scenario ends. Otherwise it creates the account:
27
28 ```sql
29 INSERT INTO project.users (username, email, full_name, password_hash, available_balance)
30 VALUES ($1, $2, $3, encode(digest($4, 'sha256'), 'hex'), 0);
31 ```
327. System confirms success and returns to the anonymous menu; Visitor can then proceed to UC0002.
33
34### Alternate flow 3a — invalid email
35
36If step 4 fails email validation, system shows "Invalid email." and scenario returns to step 2.
37
38### Alternate flow 5a — duplicate
39
40If step 5 returns `true`, system shows "Username or email already taken." and scenario ends.
Note: See TracBrowser for help on using the repository browser.