source: docs/P3-UseCaseModel/wiki/UseCase0001.md

main
Last change on this file was ef1c1c7, checked in by Stefan <trsunovstefan@…>, 6 days ago

Wiki docs, phase 6 and phase 7 added

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[ef1c1c7]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
11 1. Visitor chooses "Register" from the anonymous menu.
12 2. System prompts for username, email, full name and password.
13 3. Visitor enters values.
14 4. System validates:
15 * username, email, password are non-empty.
16 * email contains `@`.
17 * password is at least 6 characters.
18 5. System checks whether the chosen username or email already exists:
19
20{{{
21SELECT EXISTS (
22 SELECT 1 FROM project.users
23 WHERE username = $1 OR email = $2
24);
25}}}
26
27 6. If the row exists, system informs the user and the scenario ends. Otherwise it creates the account:
28
29{{{
30INSERT INTO project.users (username, email, full_name, password_hash, available_balance)
31VALUES ($1, $2, $3, encode(digest($4, 'sha256'), 'hex'), 0);
32}}}
33
34 7. System confirms success and returns to the anonymous menu; Visitor can then proceed to UC0002.
35
36=== Alternate flow 3a — invalid email ===
37
38If step 4 fails email validation, system shows "Invalid email." and scenario returns to step 2.
39
40=== Alternate flow 5a — duplicate ===
41
42If step 5 returns `true`, system shows "Username or email already taken." and scenario ends.
Note: See TracBrowser for help on using the repository browser.