feat: Add user profile update diagrams and enhance user registration flow

- Implemented Activity Diagram for User Profile Update
- Created Sequence Diagram for User Profile Update
- Added Use Case Diagram for User interactions
- Developed Class Diagram for User, Group, and Permission entities
- Added Activity and Flowchart Diagrams for User Login and Logout processes
- Created Sequence Diagram for User Login and Logout
- Implemented Activity, Flowchart, and Sequence Diagrams for User Registration process
- Added Email Verification Activity and Flowchart Diagrams
- Developed Sequence Diagram for Email Verification and Password Setup
- Created Activity and Flowchart Diagrams for Set Password process
- Enhanced JavaScript functionality for handling checkbox data in DataTables
1 parent 54771655
@startuml
title User Profile Update Activity Diagram
start
:User navigates to the "Edit Profile" page;
:User modifies their profile information;
:User enters their current password for verification;
:User submits the form;
if (Is the current password correct?) then (yes)
if (Is the new profile data valid?) then (yes)
:System checks if a 'partner' record exists for the user's email;
if (Record exists?) then (yes)
:Update the existing partner record in the database;
else (no)
:Insert a new partner record into the database;
endif
:Display "Profile updated successfully" message;
stop
else (no)
:Display validation errors for the profile data;
--> User modifies their profile information;
endif
else (no)
:Display "Incorrect password" error message;
--> User modifies their profile information;
endif
@enduml
@startuml
title User Profile Update Sequence Diagram
actor User
participant "Web Browser" as Browser
participant "Web Server" as Server
database "Database" as DB
User -> Browser : Edits profile information, enters current password, and submits form
Browser -> Server : POST /profile/update (profile data, password)
activate Server
Server -> DB : Verify current password for user
activate DB
DB --> Server : Password is correct (or not)
deactivate DB
alt Password is correct
Server -> Server : Validate incoming profile data
alt Data is valid
Server -> DB : SELECT * FROM partner WHERE email = ?
activate DB
DB --> Server : Partner record (or null)
deactivate DB
alt Partner record exists
Server -> DB : UPDATE partner SET ... WHERE email = ?
activate DB
DB --> Server : Confirmation
deactivate DB
else Partner record does not exist
Server -> DB : INSERT INTO partner (email, ...) VALUES (...)
activate DB
DB --> Server : Confirmation
deactivate DB
end
Server --> Browser : HTTP 200 OK (Profile updated successfully)
Browser -> User : Displays success message
else Data is invalid
Server --> Browser : HTTP 400 Bad Request (Validation errors)
Browser -> User : Displays error messages
end
else Password is incorrect
Server --> Browser : HTTP 401 Unauthorized (Incorrect password)
Browser -> User : Displays "Incorrect password" error
end
deactivate Server
@enduml
@startuml uc_user
left to right direction
actor User
rectangle "User Use Case" {
User -- (Register)
User -- (Login)
User -- (Update Profile)
User -- (Request Password Reset)
User -- (Logout)
User -- (Change Password)
}
@enduml
@startuml
title User, Group, and Permission Class Diagram
class User {
+id: int
+user_name: string
+user_password: string
+email: string
+status: int
+last_login_date: datetime
--
+login()
+logout()
+has_permission(permission_name): bool
}
class Group {
+id: int
+group_name: string
--
+add_user(user: User)
+remove_user(user: User)
+grant_permission(permission: Permission)
+revoke_permission(permission: Permission)
}
class Permission {
+perm_name: string
+description: string
}
' --- Relationships ---
' A User can be a member of multiple Groups.
' A Group can have multiple Users.
User "many" -- "many" Group : (is member of)
' A Group can have multiple Permissions.
' A Permission can be granted to multiple Groups.
Group "many" -- "many" Permission : (has)
@enduml
@startuml
title Login Activity Diagram
start
partition "User" {
:Enter username and password;
:Click login button;
}
partition "System" {
:Validate credentials;
if (Credentials are valid?) then (yes)
:Log in successful;
:Redirect to dashboard;
stop
else (no)
:Display error message;
endif
}
@enduml
@startuml
title Login Flowchart
start
:User navigates to Login Page;
:User enters Username and Password;
:User clicks Login button;
if (Are inputs valid?) then (yes)
:System checks credentials against Database;
if (Are credentials correct?) then (yes)
:Create session;
:Redirect to Dashboard;
stop
else (no)
:Show "Invalid credentials" error;
--> User enters Username and Password;
endif
else (no)
:Show "Input required" error;
--> User enters Username and Password;
endif
@enduml
@startuml
title Login Sequence Diagram
actor User
participant "Web Browser" as Browser
participant "Web Server" as Server
database "Database" as DB
User -> Browser : Enters username and password
Browser -> Server : POST /login (username, password)
activate Server
Server -> DB : SELECT user WHERE username = ? AND password = ?
activate DB
DB --> Server : User record (or null)
deactivate DB
alt Credentials are valid
Server -> Browser : HTTP 200 OK (Login Success)
Browser -> User : Displays success message / redirects
else Credentials are invalid
Server -> Browser : HTTP 401 Unauthorized (Login Failed)
Browser -> User : Displays error message
end
deactivate Server
@enduml
@startuml
title Logout Activity Diagram
start
:User clicks the logout button;
:System prompts for logout confirmation;
if (User confirms logout?) then (yes)
:Proceed with logout;
else (no)
:Cancel logout;
:The user redirected to the dashboard;
stop
endif
:The system terminates the user's session;
:The user is redirected to the login page;
stop
@enduml
@startuml
title Logout Flowchart
start
:User clicks Logout button;
:System displays confirmation prompt;
if (User confirms logout?) then (yes)
:Proceed with logout;
:System destroys the session;
:Redirect to Login Page;
else (no)
:Cancel logout;
:Redirect to Dashboard;
endif
stop
@enduml
@startuml
title Logout Sequence Diagram
actor User
participant "Web Browser" as Browser
participant "Web Server" as Server
User -> Browser : Clicks "Logout"
Browser -> Server : GET /logout
Server -> Browser : HTTP 200 OK (Logout Confirmation)
Browser -> User : Displays Logout Confirmation Page
User -> Browser : Clicks "Confirm Logout"
Browser -> Server : POST /logout/confirm
activate Server
Server -> Server : Invalidate user session
Server -> Browser : HTTP 302 Found (Redirect to /login)
deactivate Server
Browser -> User : Displays Login Page
@enduml
@startuml
title User Registration Activity Diagram
start
:User navigates to Registration Page;
:User fills in registration form (e.g., username, email, password);
:User submits the form;
if (Input validation fails?) then (yes)
:Display validation errors;
--> User fills in registration form;
else (no)
:Check if user already exists in Database;
if (User exists?) then (yes)
:Display "User already exists" error;
--> User fills in registration form;
else (no)
:Create new user record in the Database;
:Display registration success message;
:Sent confirmation email;
:Receive confirmation link click;
:Activate user account;
:Redirect to Password Setup Page;
:User fill password;
:Submit form;
:Validate password strength;
if (Password valid?) then (no)
:Display password error message;
--> User fill password;
else (yes)
:Update user record with password;
:Display password setup success message;
stop
endif
endif
@enduml
@startuml
title User Registration Flowchart
start
:User navigates to the registration page;
:User fills out the registration form with details like username and email;
:User clicks the 'Register' button;
if (Are all required fields filled correctly?) then (yes)
:System checks if the username or email already exists in the database;
if (Does the user already exist?) then (yes)
:Display an error message: "User already exists.";
--> User fills out the registration form;
else (no)
:System saves the new user's information to the database (status: unverified);
:System sends a verification email to the user;
:Display a success message: "Registration successful! Please check your email to verify your account.";
stop
endif
else (no)
:Display an error message indicating which fields are invalid;
--> User fills out the registration form;
endif
@enduml
@startuml
title User Registration Sequence Diagram
actor User
participant "Web Browser" as Browser
participant "Web Server" as Server
database "Database" as DB
participant "Email Service" as Email
User -> Browser : Fills out registration form (username, email)
Browser -> Server : POST /register (username, email)
activate Server
Server -> Server : Validate input data
alt Input is invalid
Server --> Browser : HTTP 400 Bad Request (Validation errors)
Browser -> User : Displays validation errors
else Input is valid
Server -> DB : SELECT user WHERE username = ? OR email = ?
activate DB
DB --> Server : (null)
deactivate DB
alt User does not exist
Server -> DB : INSERT into users (username, email, status: unverified)
activate DB
DB --> Server : New user record
deactivate DB
Server -> Email : Send verification email
Server --> Browser : HTTP 201 Created (Registration successful)
Browser -> User : Displays "Please check your email to verify your account."
else User already exists
Server --> Browser : HTTP 409 Conflict (User already exists)
Browser -> User : Displays "User already exists" error
end
end
deactivate Server
@enduml
@startuml
title Email Verification Activity Diagram
start
:User clicks the verification link sent to their email;
:System receives the verification request with a unique token;
if (Is the token valid and not expired?) then (yes)
:System marks the user's email as verified in the database;
:Display a success message: "Your email has been verified!";
:Redirect the user to the "Set Password" page;
stop
else (no)
:Display an error message: "Invalid or expired verification link.";
stop
endif
@enduml
@startuml
title Email Verification Flowchart
start
:User clicks the verification link in their email;
:System receives the request with a verification token;
if (Is the token valid and not expired?) then (yes)
:System updates the user's account status to 'verified' in the database;
:Display a success message: "Your email has been verified successfully!";
:Redirect the user to the "Set Password" page;
stop
else (no)
:Display an error message: "Invalid or expired verification link.";
stop
endif
@enduml
@startuml
title Email Verification and Password Setup Sequence Diagram
actor User
participant "Web Browser" as Browser
participant "Web Server" as Server
database "Database" as DB
User -> Browser : Clicks verification link from email
Browser -> Server : GET /verify?token=...
activate Server
Server -> DB : Find user by verification token
activate DB
DB --> Server : User record (or null)
deactivate DB
alt Token is valid and user found
Server --> Browser : HTTP 302 Found (Redirect to /set-password)
deactivate Server
Browser -> User : Displays "Set Password" page
User -> Browser : Enters and confirms new password
Browser -> Server : POST /set-password (password, token)
activate Server
Server -> Server : Validate password complexity and match
alt Password is valid and matches
Server -> DB : Update user's password (hashed)
activate DB
DB --> Server : Confirmation
deactivate DB
Server --> Browser : HTTP 200 OK (Password set)
Browser -> User : Displays "Password set successfully" / Redirects to login
else Password is not valid or does not match
Server --> Browser : HTTP 400 Bad Request (e.g., "Password does not meet requirements")
Browser -> User : Displays error message
end
else Token is invalid or expired
Server --> Browser : HTTP 400 Bad Request (Invalid token)
Browser -> User : Displays error message
end
deactivate Server
@enduml
@startuml
title Set Password Activity Diagram
start
:User is on the "Set Password" page after email verification;
:User enters a new password and confirms it;
:User submits the form;
if (Do the passwords match and meet complexity requirements?) then (yes)
:System saves the new, hashed password to the user's account;
:Display a success message: "Password successfully set!";
:Redirect user to the login page;
stop
else (no)
:Display an error message (e.g., "Passwords do not match or are not strong enough");
--> User enters a new password and confirms it;
endif
@enduml
@startuml
title Set Password Flowchart
start
:User is redirected to the "Set Password" page;
:User enters a new password and confirms it;
:User clicks the 'Set Password' button;
if (Do the passwords match and meet complexity requirements?) then (yes)
:System securely hashes the password;
:System saves the hashed password to the user's record in the database;
:Display a success message: "Your password has been set successfully!";
:Redirect the user to the login page;
stop
else (no)
:Display an error message (e.g., "Passwords do not match" or "Password does not meet requirements");
--> User enters a new password and confirms it;
endif
@enduml
@startuml
title Set Password Sequence Diagram
actor User
participant "Web Browser" as Browser
participant "Web Server" as Server
database "Database" as DB
User -> Browser : Enters and confirms new password on "Set Password" page
Browser -> Server : POST /set-password (password, confirmation, token)
activate Server
Server -> Server : Validate password (e.g., complexity, match)
alt Password is valid and matches
Server -> DB : Update user's password (hashed) using token
activate DB
DB --> Server : Confirmation
deactivate DB
Server --> Browser : HTTP 200 OK (Password set)
Browser -> User : Displays "Password set successfully" / Redirects to login
else Password is not valid or does not match
Server --> Browser : HTTP 400 Bad Request (e.g., "Passwords do not match or meet requirements")
Browser -> User : Displays error message
end
deactivate Server
@enduml
@startuml uc_user
left to right direction
actor User
rectangle "User Use Case" {
User -- (Register)
User -- (Login)
User -- (Request Password Reset)
User -- (Update Profile)
User -- (Logout)
User -- (Change Password)
(Update Profile)..> (Login):include
(Logout)..> (Login):include
(Change Password)..> (Login):include
}
@enduml
@startuml uc_admin
left to right direction
actor Admin
rectangle "User Management Use Case" {
note "All use cases except Login require Admin permission" as N
usecase (Create User) as UC_CreateUser
usecase (Manage Users) as UC_ManageUsers
usecase (Assign Group) as UC_AssignGroup
usecase (Delete User) as UC_DeleteUser
usecase (Create Group) as UC_CreateGroup
usecase (Manage Group Members) as UC_ManageGroupMembers
usecase (Assign Roles) as UC_AssignRoles
usecase (Delete Group) as UC_DeleteGroup
usecase (Login) as UC_Login
Admin -- UC_CreateUser
Admin -- UC_ManageUsers
Admin -- UC_AssignGroup
Admin -- UC_DeleteUser
Admin -- UC_CreateGroup
Admin -- UC_ManageGroupMembers
Admin -- UC_AssignRoles
Admin -- UC_DeleteGroup
UC_CreateUser ..> UC_Login : includes
UC_ManageUsers ..> UC_Login : includes
UC_AssignGroup ..> UC_Login : includes
UC_DeleteUser ..> UC_Login : includes
UC_CreateGroup ..> UC_Login : includes
UC_ManageGroupMembers ..> UC_Login: includes
UC_AssignRoles ..> UC_Login: includes
UC_DeleteGroup ..> UC_Login : includes
}
@enduml
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!