<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gsharma3</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gsharma3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Gsharma3"/>
	<updated>2026-09-20T10:15:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2535_Reimplement_User_Profile_Management_(Frontend_%2B_Backend)&amp;diff=165178</id>
		<title>CSC/ECE 517 Spring 2025 - E2535 Reimplement User Profile Management (Frontend + Backend)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2535_Reimplement_User_Profile_Management_(Frontend_%2B_Backend)&amp;diff=165178"/>
		<updated>2025-04-23T12:57:07Z</updated>

		<summary type="html">&lt;p&gt;Gsharma3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to reimplement the User Profile Management feature in the Expertiza system, replacing the legacy Ruby-based frontend with a modern, responsive interface built using React with TypeScript, while retaining and enhancing the existing Ruby on Rails backend.&lt;br /&gt;
&lt;br /&gt;
This modernization effort addresses the challenges posed by outdated UI, limited form validation, and insecure session handling in the current implementation. By leveraging modern frameworks and best practices, the new system will allow users to securely update their profile details, manage email and notification preferences, and change passwords.&lt;br /&gt;
&lt;br /&gt;
The improved design will enhance maintainability, user experience, and security, aligning with Expertiza’s broader goal of offering a user-friendly, scalable, and secure open-source platform for peer-reviewed assignments.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
The current user profile management system in Expertiza is built using legacy Ruby views, which makes it difficult to maintain, extend, and modernize. The UI lacks responsiveness, and the user experience is hindered by minimal validation, outdated styling, and insufficient feedback mechanisms.&lt;br /&gt;
&lt;br /&gt;
From a security perspective, the current system does not follow best practices for handling sensitive operations such as password changes and session management. For instance:&lt;br /&gt;
* Password updates do not log out other active sessions, leaving accounts vulnerable.&lt;br /&gt;
* API responses may expose too much information, enabling account enumeration.&lt;br /&gt;
* There is no rate limiting, making the system susceptible to brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
These limitations lead to:&lt;br /&gt;
* Poor user experience (UX) and accessibility&lt;br /&gt;
* Increased technical debt and maintenance burden&lt;br /&gt;
* Security risks in managing user authentication and sessions&lt;br /&gt;
&lt;br /&gt;
As Expertiza evolves, it is essential to rebuild the profile management feature using modern frontend technologies and robust backend practices that improve usability, security, and maintainability.&lt;br /&gt;
&lt;br /&gt;
== Existing Issues ==&lt;br /&gt;
&lt;br /&gt;
* '''Legacy Frontend Implementation''': &lt;br /&gt;
** Uses Ruby templates, limiting flexibility and scalability. &lt;br /&gt;
** Transition to React will improve maintainability and user experience.&lt;br /&gt;
* '''Inconsistent Form Validation''': &lt;br /&gt;
** Validation is not uniform, leading to unclear user feedback. &lt;br /&gt;
** React Hook Form will be used for consistent validation.&lt;br /&gt;
* '''Limited Security for Password Changes''': &lt;br /&gt;
** No session invalidation after password updates. &lt;br /&gt;
** New implementation will log out all active sessions and invalidate old tokens.&lt;br /&gt;
* '''Basic Error Handling''': &lt;br /&gt;
** Current error handling is minimal and vague. &lt;br /&gt;
** Enhanced error messages and better handling for edge cases will be implemented.&lt;br /&gt;
* '''Outdated User Interface''': &lt;br /&gt;
** The UI is not modern or responsive. &lt;br /&gt;
** A redesigned UI will be created for improved user interaction and accessibility.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
=== Front-End ===&lt;br /&gt;
&lt;br /&gt;
Enhance usability and data integrity through a tab-based layout that organizes the profile page into distinct sections, ensuring that users can update specific areas independently without risk of data loss.&lt;br /&gt;
&lt;br /&gt;
==== Key Features ====&lt;br /&gt;
&lt;br /&gt;
* Tab-based Layout &lt;br /&gt;
** The profile page will be restructured into multiple tabs, with each tab dedicated to a specific subsection (e.g., Personal Details, Password, Notification Settings).&lt;br /&gt;
** This separation allows users to navigate between different sections without losing unsaved data from other areas.&lt;br /&gt;
&lt;br /&gt;
* Dedicated Forms for Each Section&lt;br /&gt;
** Implement separate forms for each tab using React Hook Form which enables efficient state management and robust schema-driven validations.&lt;br /&gt;
** Ensure that each form manages its own state and validation logic independently, avoiding interference between sections.&lt;br /&gt;
&lt;br /&gt;
* Enhanced User Experience &lt;br /&gt;
** Users will benefit from clear, compartmentalized UI sections, reducing cognitive load and streamlining the update process.&lt;br /&gt;
** Real-time validation and dedicated feedback per section will help prevent input errors and improve overall form usability.&lt;br /&gt;
&lt;br /&gt;
==== Proposed Wireframes ====&lt;br /&gt;
[[File:wireframes1.png|600px|Wireframe 1]]&lt;br /&gt;
[[File:wireframes2.png|600px|Wireframe 2]]&lt;br /&gt;
[[File:wireframes3.png|600px|Wireframe 3]]&lt;br /&gt;
[[File:wireframes4.png|600px|Wireframe 4]]&lt;br /&gt;
[[File:wireframes5.png|600px|Wireframe 5]]&lt;br /&gt;
&lt;br /&gt;
''Attached Wireframes are not to be mistaken as actual designs or the live application/website.''&lt;br /&gt;
&lt;br /&gt;
==== File Modifications ====&lt;br /&gt;
* Edit the existing code in [https://github.com/expertiza/reimplementation-front-end/blob/main/src/pages/Profile/Edit.tsx `src/pages/Profile/Edit.tsx`] to implement the new layout.&lt;br /&gt;
&lt;br /&gt;
=== Back-End ===&lt;br /&gt;
&lt;br /&gt;
The backend will be enhanced to support secure, RESTful profile and password updates, while incorporating session management and protection against attacks.&lt;br /&gt;
&lt;br /&gt;
==== User Model Enhancements ====&lt;br /&gt;
Add/update methods to: &lt;br /&gt;
* Safely update user profile fields (e.g., name, email)&lt;br /&gt;
* Change passwords using bcrypt for hashing&lt;br /&gt;
* Invalidate old sessions upon password update&lt;br /&gt;
&lt;br /&gt;
==== New API Endpoints ====&lt;br /&gt;
There are some of the proposed endpoints for the reimplementation.&lt;br /&gt;
* `GET /api/v1/profile` – Fetch current user details&lt;br /&gt;
* `PUT /api/v1/profile` – Update user profile&lt;br /&gt;
* `PUT /api/v1/profile/password` – Update password securely&lt;br /&gt;
&lt;br /&gt;
==== Session Management ====&lt;br /&gt;
* Log out all active sessions after a successful password change&lt;br /&gt;
* Revoke previous tokens to ensure account safety&lt;br /&gt;
&lt;br /&gt;
==== Security Measures ====&lt;br /&gt;
* Implement rate limiting with `Rack::Attack` to prevent brute-force attacks&lt;br /&gt;
* Return generic error messages for failed logins to avoid account enumeration&lt;br /&gt;
&lt;br /&gt;
==Database Changes==&lt;br /&gt;
&lt;br /&gt;
The existing `users` table currently includes all the necessary fields required for user profile management, such as name, email, and password. As of now, no immediate changes to the schema are required. However, during the implementation phase, if additional fields are identified as necessary, the schema will be updated accordingly. Any modifications to the schema will be thoroughly reviewed and documented to ensure they align with the project requirements and maintain data integrity.&lt;br /&gt;
&lt;br /&gt;
==Overview of Classes==&lt;br /&gt;
&lt;br /&gt;
=== UsersController (app/controllers/api/v1/users_controller.rb) ===&lt;br /&gt;
Will be extended to:&lt;br /&gt;
* `GET /profile`: Return current user details (JSON)&lt;br /&gt;
* `PUT /profile`: Update user attributes like name, email, notification preferences&lt;br /&gt;
&lt;br /&gt;
=== PasswordsController (app/controllers/api/v1/passwords_controller.rb) ===&lt;br /&gt;
Will handle secure password changes via:&lt;br /&gt;
* `PUT /password`:&lt;br /&gt;
** Authenticate using current password&lt;br /&gt;
** Update using bcrypt&lt;br /&gt;
** Invalidate old sessions/tokens&lt;br /&gt;
** Issue a new session token&lt;br /&gt;
&lt;br /&gt;
=== User Model (app/models/user.rb) ===&lt;br /&gt;
Updated to include:&lt;br /&gt;
* `update_profile(params)` method for secure profile updates&lt;br /&gt;
* `change_password(current_password, new_password)` with proper validations&lt;br /&gt;
* Session/token handling logic after password changes&lt;br /&gt;
&lt;br /&gt;
=== AuthenticationTokenService / Session Handler ===&lt;br /&gt;
* Issues new tokens upon password change&lt;br /&gt;
* Invalidates previous sessions to prevent unauthorized access&lt;br /&gt;
&lt;br /&gt;
=== ApplicationController ===&lt;br /&gt;
* Handles token-based authentication for API access&lt;br /&gt;
* Provides common methods for current user lookup and error handling&lt;br /&gt;
&lt;br /&gt;
=== Rack::Attack Configuration (config/initializers/rack_attack.rb) ===&lt;br /&gt;
* Implements rate limiting for profile and password update endpoints&lt;br /&gt;
* Helps mitigate brute-force and enumeration attacks&lt;br /&gt;
&lt;br /&gt;
=== Class Diagram ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:ClassDiagramE2535.png||Class Diagram]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&lt;br /&gt;
=== Usability &amp;amp; User Experience (UX) ===&lt;br /&gt;
* '''Intuitive Interface''': The user profile page should be easy to navigate with clear sections for updating profile information, changing passwords, and managing notifications. Each form will include:&lt;br /&gt;
** Informative tooltips and labels&lt;br /&gt;
** Clear error messages and success notifications&lt;br /&gt;
** Loading indicators to improve responsiveness&lt;br /&gt;
&lt;br /&gt;
* '''Responsive Design''': The profile page must be fully responsive across various devices, from desktops to mobile phones, ensuring an optimized experience for all users.&lt;br /&gt;
&lt;br /&gt;
* '''Smooth Transitions''': Using React Router, transitions between different sections (such as profile editing and password change) should feel seamless without page reloads, improving the overall user experience.&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* '''Password Management'''&lt;br /&gt;
** Use bcrypt to hash passwords securely before saving them to the database.&lt;br /&gt;
** Implement token-based authentication for user sessions.&lt;br /&gt;
** When the password is updated, invalidate all active sessions and issue a new authentication token to prevent unauthorized access.&lt;br /&gt;
&lt;br /&gt;
* '''Rate Limiting''': To prevent brute-force attacks, rate limiting will be implemented on sensitive endpoints like the password change and login routes using Rack::Attack.&lt;br /&gt;
&lt;br /&gt;
* '''Account Enumeration Protection''': Return generic error messages on failed login attempts and password changes to prevent attackers from determining whether a username/email is valid.&lt;br /&gt;
&lt;br /&gt;
* '''Session Management''': When a password is successfully updated, ensure that all other active sessions are logged out and new tokens are issued to prevent session hijacking.&lt;br /&gt;
&lt;br /&gt;
=== Maintainability &amp;amp; Scalability ===&lt;br /&gt;
* '''Modular Codebase''': The code will follow a modular approach by breaking down functionality into smaller, reusable components (both frontend and backend). For example, the frontend components will be encapsulated, and the backend logic will be implemented using service objects where appropriate.&lt;br /&gt;
&lt;br /&gt;
* '''RESTful API Structure''': The backend will adhere to RESTful principles for API endpoints, ensuring that the architecture is scalable and easily extendable in the future. Common conventions like GET, PUT, and PATCH will be used for profile and password management.&lt;br /&gt;
&lt;br /&gt;
* '''Separation of Concerns''': The frontend and backend will be clearly separated with well-defined API contracts. The frontend will handle the presentation and user interactions, while the backend will focus on business logic and data persistence.&lt;br /&gt;
&lt;br /&gt;
* '''Testing and Quality Assurance''': Automated tests will be implemented to ensure the robustness of the system. RSpec will be used for backend testing, and Jest will be used for frontend testing.&lt;br /&gt;
&lt;br /&gt;
=== Code Quality ===&lt;br /&gt;
* '''Adhere to DRY Principles''': The code will avoid repetition by creating reusable components and centralized validation logic for both frontend and backend. For example, validation logic for user input will be shared between the frontend (React Hook Form validation) and the backend (model validations).&lt;br /&gt;
&lt;br /&gt;
* '''Consistent API Responses''': API responses will be standardized across endpoints to ensure a consistent interface for the frontend. This includes:&lt;br /&gt;
** Returning relevant HTTP status codes&lt;br /&gt;
** Structuring responses with consistent fields &lt;br /&gt;
&lt;br /&gt;
* '''Clear Documentation''': The documentation will be maintained, detailing endpoint routes, required parameters, expected responses, and error handling procedures.&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan  ==&lt;br /&gt;
&lt;br /&gt;
=== Frontend Implementation ===&lt;br /&gt;
* Create new React components&lt;br /&gt;
* Implement validation of form fields&lt;br /&gt;
* Connect to backend endpoints&lt;br /&gt;
* Add success/confirmation messages on profile updates&lt;br /&gt;
* Add loading states and error handling&lt;br /&gt;
* Implement responsive design&lt;br /&gt;
&lt;br /&gt;
=== Backend Implementation ===&lt;br /&gt;
* Update UserController with new endpoints&lt;br /&gt;
* Implement password security measures&lt;br /&gt;
* Add rate limiting functionality&lt;br /&gt;
* Update user model validation&lt;br /&gt;
* Implement session management&lt;br /&gt;
&lt;br /&gt;
==== Sequence Diagram ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SequenceDiagram.png|600px|Sequence Diagram]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Frontend Implementation ===&lt;br /&gt;
The new UI redesign replicates the functionality of the original page, now leveraging TypeScript for type safety and React for dynamic rendering. This approach enhances the user experience by providing a more responsive and accessible interface, while adhering to modern design principles. This feature redesigns the Edit Profile page, implementing a modern, form-based interface using React, TypeScript, and React Hook Form, with full backend integration for real-time data fetch and update. The new UI focuses on form validation, user experience, and code maintainability.&lt;br /&gt;
&lt;br /&gt;
Key Features:&lt;br /&gt;
* Form Management: Uses `react-hook-form` and `yup` for structured form handling and ensuring reliable input checks and robust form validation&lt;br /&gt;
* Backend Integration: Profile data is fetched from the backend and is used to populate the form fields. On submission, this data is validated and triggers an API request to update profile and password (if the password is changed).&lt;br /&gt;
* API Communication: Uses `axios` for making HTTP requests to fetch user profile data and submit updates to the backend, including GET, PATCH and POST requests with authentication headers.&lt;br /&gt;
* UI Enhancements: Improved error handling and form usability. `Yup` validation checks data before it is sent to the backend, ensuring fast display of errors. The form also display success and error messages for API requests.&lt;br /&gt;
&lt;br /&gt;
[[File:FinalUI.png|600px|Form View - User can edit profile fields]]&lt;br /&gt;
[[File:FinalUI-Success.png|600px|Success Message - Profile updated successfully]]&lt;br /&gt;
[[File:FinalUI-Failure.png|600px|Error Message - Displaying validation error]]&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
=== Unit Tests ===&lt;br /&gt;
* '''Details''': Write tests to validate that the model validations are functioning correctly.&lt;br /&gt;
* '''Focus''': Ensure associations are set up properly (`belongs_to`, `has_many`), and no dangling records are left after CRUD operations.&lt;br /&gt;
&lt;br /&gt;
=== Functional Tests ===&lt;br /&gt;
* '''Details''': Use RSpec to test the behavior of the controllers.&lt;br /&gt;
* '''Focus''': Verify that the controllers correctly handle user input and update the database.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
* '''Details''': Validate the overall user experience.&lt;br /&gt;
* '''Focus''': Test UI layout, responsiveness, toggle functionality (password visibility), and the system's performance under normal usage.&lt;br /&gt;
&lt;br /&gt;
==Mentor==&lt;br /&gt;
&lt;br /&gt;
* [mailto:pkodali@ncsu.edu Prathyusha Kodali]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
* [mailto:dsaraog@ncsu.edu Devang Saraogi]&lt;br /&gt;
* [mailto:gsharma3@ncsu.edu Galav Sharma]&lt;br /&gt;
* [mailto:jshah23@ncsu.edu Jash Shah]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
* [https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
* [https://docs.google.com/document/d/1jjbqggRDiOHrxdsMlliY62JnP34bGTNHVWAZNz89kT8/edit?usp=sharing Final Projects on Expertiza]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-front-end Front-end Github]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-back-end Back-end Github]&lt;/div&gt;</summary>
		<author><name>Gsharma3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2535_Reimplement_User_Profile_Management_(Frontend_%2B_Backend)&amp;diff=165177</id>
		<title>CSC/ECE 517 Spring 2025 - E2535 Reimplement User Profile Management (Frontend + Backend)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2535_Reimplement_User_Profile_Management_(Frontend_%2B_Backend)&amp;diff=165177"/>
		<updated>2025-04-23T12:52:41Z</updated>

		<summary type="html">&lt;p&gt;Gsharma3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to reimplement the User Profile Management feature in the Expertiza system, replacing the legacy Ruby-based frontend with a modern, responsive interface built using React with TypeScript, while retaining and enhancing the existing Ruby on Rails backend.&lt;br /&gt;
&lt;br /&gt;
This modernization effort addresses the challenges posed by outdated UI, limited form validation, and insecure session handling in the current implementation. By leveraging modern frameworks and best practices, the new system will allow users to securely update their profile details, manage email and notification preferences, and change passwords.&lt;br /&gt;
&lt;br /&gt;
The improved design will enhance maintainability, user experience, and security, aligning with Expertiza’s broader goal of offering a user-friendly, scalable, and secure open-source platform for peer-reviewed assignments.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
The current user profile management system in Expertiza is built using legacy Ruby views, which makes it difficult to maintain, extend, and modernize. The UI lacks responsiveness, and the user experience is hindered by minimal validation, outdated styling, and insufficient feedback mechanisms.&lt;br /&gt;
&lt;br /&gt;
From a security perspective, the current system does not follow best practices for handling sensitive operations such as password changes and session management. For instance:&lt;br /&gt;
* Password updates do not log out other active sessions, leaving accounts vulnerable.&lt;br /&gt;
* API responses may expose too much information, enabling account enumeration.&lt;br /&gt;
* There is no rate limiting, making the system susceptible to brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
These limitations lead to:&lt;br /&gt;
* Poor user experience (UX) and accessibility&lt;br /&gt;
* Increased technical debt and maintenance burden&lt;br /&gt;
* Security risks in managing user authentication and sessions&lt;br /&gt;
&lt;br /&gt;
As Expertiza evolves, it is essential to rebuild the profile management feature using modern frontend technologies and robust backend practices that improve usability, security, and maintainability.&lt;br /&gt;
&lt;br /&gt;
== Existing Issues ==&lt;br /&gt;
&lt;br /&gt;
* '''Legacy Frontend Implementation''': &lt;br /&gt;
** Uses Ruby templates, limiting flexibility and scalability. &lt;br /&gt;
** Transition to React will improve maintainability and user experience.&lt;br /&gt;
* '''Inconsistent Form Validation''': &lt;br /&gt;
** Validation is not uniform, leading to unclear user feedback. &lt;br /&gt;
** React Hook Form will be used for consistent validation.&lt;br /&gt;
* '''Limited Security for Password Changes''': &lt;br /&gt;
** No session invalidation after password updates. &lt;br /&gt;
** New implementation will log out all active sessions and invalidate old tokens.&lt;br /&gt;
* '''Basic Error Handling''': &lt;br /&gt;
** Current error handling is minimal and vague. &lt;br /&gt;
** Enhanced error messages and better handling for edge cases will be implemented.&lt;br /&gt;
* '''Outdated User Interface''': &lt;br /&gt;
** The UI is not modern or responsive. &lt;br /&gt;
** A redesigned UI will be created for improved user interaction and accessibility.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
=== Front-End ===&lt;br /&gt;
&lt;br /&gt;
Enhance usability and data integrity through a tab-based layout that organizes the profile page into distinct sections, ensuring that users can update specific areas independently without risk of data loss.&lt;br /&gt;
&lt;br /&gt;
==== Key Features ====&lt;br /&gt;
&lt;br /&gt;
* Tab-based Layout &lt;br /&gt;
** The profile page will be restructured into multiple tabs, with each tab dedicated to a specific subsection (e.g., Personal Details, Password, Notification Settings).&lt;br /&gt;
** This separation allows users to navigate between different sections without losing unsaved data from other areas.&lt;br /&gt;
&lt;br /&gt;
* Dedicated Forms for Each Section&lt;br /&gt;
** Implement separate forms for each tab using React Hook Form which enables efficient state management and robust schema-driven validations.&lt;br /&gt;
** Ensure that each form manages its own state and validation logic independently, avoiding interference between sections.&lt;br /&gt;
&lt;br /&gt;
* Enhanced User Experience &lt;br /&gt;
** Users will benefit from clear, compartmentalized UI sections, reducing cognitive load and streamlining the update process.&lt;br /&gt;
** Real-time validation and dedicated feedback per section will help prevent input errors and improve overall form usability.&lt;br /&gt;
&lt;br /&gt;
==== Proposed Wireframes ====&lt;br /&gt;
[[File:wireframes1.png|600px|Wireframe 1]]&lt;br /&gt;
[[File:wireframes2.png|600px|Wireframe 2]]&lt;br /&gt;
[[File:wireframes3.png|600px|Wireframe 3]]&lt;br /&gt;
[[File:wireframes4.png|600px|Wireframe 4]]&lt;br /&gt;
[[File:wireframes5.png|600px|Wireframe 5]]&lt;br /&gt;
&lt;br /&gt;
''Attached Wireframes are not to be mistaken as actual designs or the live application/website.''&lt;br /&gt;
&lt;br /&gt;
==== File Modifications ====&lt;br /&gt;
* Edit the existing code in [https://github.com/expertiza/reimplementation-front-end/blob/main/src/pages/Profile/Edit.tsx `src/pages/Profile/Edit.tsx`] to implement the new layout.&lt;br /&gt;
&lt;br /&gt;
=== Back-End ===&lt;br /&gt;
&lt;br /&gt;
The backend will be enhanced to support secure, RESTful profile and password updates, while incorporating session management and protection against attacks.&lt;br /&gt;
&lt;br /&gt;
==== User Model Enhancements ====&lt;br /&gt;
Add/update methods to: &lt;br /&gt;
* Safely update user profile fields (e.g., name, email)&lt;br /&gt;
* Change passwords using bcrypt for hashing&lt;br /&gt;
* Invalidate old sessions upon password update&lt;br /&gt;
&lt;br /&gt;
==== New API Endpoints ====&lt;br /&gt;
There are some of the proposed endpoints for the reimplementation.&lt;br /&gt;
* `GET /api/v1/profile` – Fetch current user details&lt;br /&gt;
* `PUT /api/v1/profile` – Update user profile&lt;br /&gt;
* `PUT /api/v1/profile/password` – Update password securely&lt;br /&gt;
&lt;br /&gt;
==== Session Management ====&lt;br /&gt;
* Log out all active sessions after a successful password change&lt;br /&gt;
* Revoke previous tokens to ensure account safety&lt;br /&gt;
&lt;br /&gt;
==== Security Measures ====&lt;br /&gt;
* Implement rate limiting with `Rack::Attack` to prevent brute-force attacks&lt;br /&gt;
* Return generic error messages for failed logins to avoid account enumeration&lt;br /&gt;
&lt;br /&gt;
==Database Changes==&lt;br /&gt;
&lt;br /&gt;
The existing `users` table currently includes all the necessary fields required for user profile management, such as name, email, and password. As of now, no immediate changes to the schema are required. However, during the implementation phase, if additional fields are identified as necessary, the schema will be updated accordingly. Any modifications to the schema will be thoroughly reviewed and documented to ensure they align with the project requirements and maintain data integrity.&lt;br /&gt;
&lt;br /&gt;
==Overview of Classes==&lt;br /&gt;
&lt;br /&gt;
=== UsersController (app/controllers/api/v1/users_controller.rb) ===&lt;br /&gt;
Will be extended to:&lt;br /&gt;
* `GET /profile`: Return current user details (JSON)&lt;br /&gt;
* `PUT /profile`: Update user attributes like name, email, notification preferences&lt;br /&gt;
&lt;br /&gt;
=== PasswordsController (app/controllers/api/v1/passwords_controller.rb) ===&lt;br /&gt;
Will handle secure password changes via:&lt;br /&gt;
* `PUT /password`:&lt;br /&gt;
** Authenticate using current password&lt;br /&gt;
** Update using bcrypt&lt;br /&gt;
** Invalidate old sessions/tokens&lt;br /&gt;
** Issue a new session token&lt;br /&gt;
&lt;br /&gt;
=== User Model (app/models/user.rb) ===&lt;br /&gt;
Updated to include:&lt;br /&gt;
* `update_profile(params)` method for secure profile updates&lt;br /&gt;
* `change_password(current_password, new_password)` with proper validations&lt;br /&gt;
* Session/token handling logic after password changes&lt;br /&gt;
&lt;br /&gt;
=== AuthenticationTokenService / Session Handler ===&lt;br /&gt;
* Issues new tokens upon password change&lt;br /&gt;
* Invalidates previous sessions to prevent unauthorized access&lt;br /&gt;
&lt;br /&gt;
=== ApplicationController ===&lt;br /&gt;
* Handles token-based authentication for API access&lt;br /&gt;
* Provides common methods for current user lookup and error handling&lt;br /&gt;
&lt;br /&gt;
=== Rack::Attack Configuration (config/initializers/rack_attack.rb) ===&lt;br /&gt;
* Implements rate limiting for profile and password update endpoints&lt;br /&gt;
* Helps mitigate brute-force and enumeration attacks&lt;br /&gt;
&lt;br /&gt;
=== Class Diagram ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:ClassDiagramE2535.png||Class Diagram]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&lt;br /&gt;
=== Usability &amp;amp; User Experience (UX) ===&lt;br /&gt;
* '''Intuitive Interface''': The user profile page should be easy to navigate with clear sections for updating profile information, changing passwords, and managing notifications. Each form will include:&lt;br /&gt;
** Informative tooltips and labels&lt;br /&gt;
** Clear error messages and success notifications&lt;br /&gt;
** Loading indicators to improve responsiveness&lt;br /&gt;
&lt;br /&gt;
* '''Responsive Design''': The profile page must be fully responsive across various devices, from desktops to mobile phones, ensuring an optimized experience for all users.&lt;br /&gt;
&lt;br /&gt;
* '''Smooth Transitions''': Using React Router, transitions between different sections (such as profile editing and password change) should feel seamless without page reloads, improving the overall user experience.&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* '''Password Management'''&lt;br /&gt;
** Use bcrypt to hash passwords securely before saving them to the database.&lt;br /&gt;
** Implement token-based authentication for user sessions.&lt;br /&gt;
** When the password is updated, invalidate all active sessions and issue a new authentication token to prevent unauthorized access.&lt;br /&gt;
&lt;br /&gt;
* '''Rate Limiting''': To prevent brute-force attacks, rate limiting will be implemented on sensitive endpoints like the password change and login routes using Rack::Attack.&lt;br /&gt;
&lt;br /&gt;
* '''Account Enumeration Protection''': Return generic error messages on failed login attempts and password changes to prevent attackers from determining whether a username/email is valid.&lt;br /&gt;
&lt;br /&gt;
* '''Session Management''': When a password is successfully updated, ensure that all other active sessions are logged out and new tokens are issued to prevent session hijacking.&lt;br /&gt;
&lt;br /&gt;
=== Maintainability &amp;amp; Scalability ===&lt;br /&gt;
* '''Modular Codebase''': The code will follow a modular approach by breaking down functionality into smaller, reusable components (both frontend and backend). For example, the frontend components will be encapsulated, and the backend logic will be implemented using service objects where appropriate.&lt;br /&gt;
&lt;br /&gt;
* '''RESTful API Structure''': The backend will adhere to RESTful principles for API endpoints, ensuring that the architecture is scalable and easily extendable in the future. Common conventions like GET, PUT, and PATCH will be used for profile and password management.&lt;br /&gt;
&lt;br /&gt;
* '''Separation of Concerns''': The frontend and backend will be clearly separated with well-defined API contracts. The frontend will handle the presentation and user interactions, while the backend will focus on business logic and data persistence.&lt;br /&gt;
&lt;br /&gt;
* '''Testing and Quality Assurance''': Automated tests will be implemented to ensure the robustness of the system. RSpec will be used for backend testing, and Jest will be used for frontend testing.&lt;br /&gt;
&lt;br /&gt;
=== Code Quality ===&lt;br /&gt;
* '''Adhere to DRY Principles''': The code will avoid repetition by creating reusable components and centralized validation logic for both frontend and backend. For example, validation logic for user input will be shared between the frontend (React Hook Form validation) and the backend (model validations).&lt;br /&gt;
&lt;br /&gt;
* '''Consistent API Responses''': API responses will be standardized across endpoints to ensure a consistent interface for the frontend. This includes:&lt;br /&gt;
** Returning relevant HTTP status codes&lt;br /&gt;
** Structuring responses with consistent fields &lt;br /&gt;
&lt;br /&gt;
* '''Clear Documentation''': The documentation will be maintained, detailing endpoint routes, required parameters, expected responses, and error handling procedures.&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan  ==&lt;br /&gt;
&lt;br /&gt;
=== Frontend Implementation ===&lt;br /&gt;
* Create new React components&lt;br /&gt;
* Implement validation of form fields&lt;br /&gt;
* Connect to backend endpoints&lt;br /&gt;
* Add success/confirmation messages on profile updates&lt;br /&gt;
* Add loading states and error handling&lt;br /&gt;
* Implement responsive design&lt;br /&gt;
&lt;br /&gt;
=== Backend Implementation ===&lt;br /&gt;
* Update UserController with new endpoints&lt;br /&gt;
* Implement password security measures&lt;br /&gt;
* Add rate limiting functionality&lt;br /&gt;
* Update user model validation&lt;br /&gt;
* Implement session management&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frontend Implementation ===&lt;br /&gt;
The new UI redesign replicates the functionality of the original page, now leveraging TypeScript for type safety and React for dynamic rendering. This approach enhances the user experience by providing a more responsive and accessible interface, while adhering to modern design principles. This feature redesigns the Edit Profile page, implementing a modern, form-based interface using React, TypeScript, and React Hook Form, with full backend integration for real-time data fetch and update. The new UI focuses on form validation, user experience, and code maintainability.&lt;br /&gt;
&lt;br /&gt;
Key Features:&lt;br /&gt;
* Form Management: Uses `react-hook-form` and `yup` for structured form handling and ensuring reliable input checks and robust form validation&lt;br /&gt;
* Backend Integration: Profile data is fetched from the backend and is used to populate the form fields. On submission, this data is validated and triggers an API request to update profile and password (if the password is changed).&lt;br /&gt;
* API Communication: Uses `axios` for making HTTP requests to fetch user profile data and submit updates to the backend, including GET, PATCH and POST requests with authentication headers.&lt;br /&gt;
* UI Enhancements: Improved error handling and form usability. `Yup` validation checks data before it is sent to the backend, ensuring fast display of errors. The form also display success and error messages for API requests.&lt;br /&gt;
&lt;br /&gt;
[[File:FinalUI.png|600px|Form View - User can edit profile fields]]&lt;br /&gt;
[[File:FinalUI-Success.png|600px|Success Message - Profile updated successfully]]&lt;br /&gt;
[[File:FinalUI-Failure.png|600px|Error Message - Displaying validation error]]&lt;br /&gt;
&lt;br /&gt;
==== Sequence Diagram ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SequenceDiagram.png|600px|Sequence Diagram]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
=== Unit Tests ===&lt;br /&gt;
* '''Details''': Write tests to validate that the model validations are functioning correctly.&lt;br /&gt;
* '''Focus''': Ensure associations are set up properly (`belongs_to`, `has_many`), and no dangling records are left after CRUD operations.&lt;br /&gt;
&lt;br /&gt;
=== Functional Tests ===&lt;br /&gt;
* '''Details''': Use RSpec to test the behavior of the controllers.&lt;br /&gt;
* '''Focus''': Verify that the controllers correctly handle user input and update the database.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
* '''Details''': Validate the overall user experience.&lt;br /&gt;
* '''Focus''': Test UI layout, responsiveness, toggle functionality (password visibility), and the system's performance under normal usage.&lt;br /&gt;
&lt;br /&gt;
==Mentor==&lt;br /&gt;
&lt;br /&gt;
* [mailto:pkodali@ncsu.edu Prathyusha Kodali]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
* [mailto:dsaraog@ncsu.edu Devang Saraogi]&lt;br /&gt;
* [mailto:gsharma3@ncsu.edu Galav Sharma]&lt;br /&gt;
* [mailto:jshah23@ncsu.edu Jash Shah]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
* [https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
* [https://docs.google.com/document/d/1jjbqggRDiOHrxdsMlliY62JnP34bGTNHVWAZNz89kT8/edit?usp=sharing Final Projects on Expertiza]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-front-end Front-end Github]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-back-end Back-end Github]&lt;/div&gt;</summary>
		<author><name>Gsharma3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalUI-Failure.png&amp;diff=165176</id>
		<title>File:FinalUI-Failure.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalUI-Failure.png&amp;diff=165176"/>
		<updated>2025-04-23T12:37:08Z</updated>

		<summary type="html">&lt;p&gt;Gsharma3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Gsharma3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalUI-Success.png&amp;diff=165175</id>
		<title>File:FinalUI-Success.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalUI-Success.png&amp;diff=165175"/>
		<updated>2025-04-23T12:35:22Z</updated>

		<summary type="html">&lt;p&gt;Gsharma3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Gsharma3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalUI.png&amp;diff=165174</id>
		<title>File:FinalUI.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:FinalUI.png&amp;diff=165174"/>
		<updated>2025-04-23T12:28:04Z</updated>

		<summary type="html">&lt;p&gt;Gsharma3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Gsharma3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2535_Reimplement_User_Profile_Management_(Frontend_%2B_Backend)&amp;diff=165173</id>
		<title>CSC/ECE 517 Spring 2025 - E2535 Reimplement User Profile Management (Frontend + Backend)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2025_-_E2535_Reimplement_User_Profile_Management_(Frontend_%2B_Backend)&amp;diff=165173"/>
		<updated>2025-04-23T12:27:45Z</updated>

		<summary type="html">&lt;p&gt;Gsharma3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to reimplement the User Profile Management feature in the Expertiza system, replacing the legacy Ruby-based frontend with a modern, responsive interface built using React with TypeScript, while retaining and enhancing the existing Ruby on Rails backend.&lt;br /&gt;
&lt;br /&gt;
This modernization effort addresses the challenges posed by outdated UI, limited form validation, and insecure session handling in the current implementation. By leveraging modern frameworks and best practices, the new system will allow users to securely update their profile details, manage email and notification preferences, and change passwords.&lt;br /&gt;
&lt;br /&gt;
The improved design will enhance maintainability, user experience, and security, aligning with Expertiza’s broader goal of offering a user-friendly, scalable, and secure open-source platform for peer-reviewed assignments.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
The current user profile management system in Expertiza is built using legacy Ruby views, which makes it difficult to maintain, extend, and modernize. The UI lacks responsiveness, and the user experience is hindered by minimal validation, outdated styling, and insufficient feedback mechanisms.&lt;br /&gt;
&lt;br /&gt;
From a security perspective, the current system does not follow best practices for handling sensitive operations such as password changes and session management. For instance:&lt;br /&gt;
* Password updates do not log out other active sessions, leaving accounts vulnerable.&lt;br /&gt;
* API responses may expose too much information, enabling account enumeration.&lt;br /&gt;
* There is no rate limiting, making the system susceptible to brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
These limitations lead to:&lt;br /&gt;
* Poor user experience (UX) and accessibility&lt;br /&gt;
* Increased technical debt and maintenance burden&lt;br /&gt;
* Security risks in managing user authentication and sessions&lt;br /&gt;
&lt;br /&gt;
As Expertiza evolves, it is essential to rebuild the profile management feature using modern frontend technologies and robust backend practices that improve usability, security, and maintainability.&lt;br /&gt;
&lt;br /&gt;
== Existing Issues ==&lt;br /&gt;
&lt;br /&gt;
* '''Legacy Frontend Implementation''': &lt;br /&gt;
** Uses Ruby templates, limiting flexibility and scalability. &lt;br /&gt;
** Transition to React will improve maintainability and user experience.&lt;br /&gt;
* '''Inconsistent Form Validation''': &lt;br /&gt;
** Validation is not uniform, leading to unclear user feedback. &lt;br /&gt;
** React Hook Form will be used for consistent validation.&lt;br /&gt;
* '''Limited Security for Password Changes''': &lt;br /&gt;
** No session invalidation after password updates. &lt;br /&gt;
** New implementation will log out all active sessions and invalidate old tokens.&lt;br /&gt;
* '''Basic Error Handling''': &lt;br /&gt;
** Current error handling is minimal and vague. &lt;br /&gt;
** Enhanced error messages and better handling for edge cases will be implemented.&lt;br /&gt;
* '''Outdated User Interface''': &lt;br /&gt;
** The UI is not modern or responsive. &lt;br /&gt;
** A redesigned UI will be created for improved user interaction and accessibility.&lt;br /&gt;
&lt;br /&gt;
==Proposed Changes==&lt;br /&gt;
&lt;br /&gt;
=== Front-End ===&lt;br /&gt;
&lt;br /&gt;
Enhance usability and data integrity through a tab-based layout that organizes the profile page into distinct sections, ensuring that users can update specific areas independently without risk of data loss.&lt;br /&gt;
&lt;br /&gt;
==== Key Features ====&lt;br /&gt;
&lt;br /&gt;
* Tab-based Layout &lt;br /&gt;
** The profile page will be restructured into multiple tabs, with each tab dedicated to a specific subsection (e.g., Personal Details, Password, Notification Settings).&lt;br /&gt;
** This separation allows users to navigate between different sections without losing unsaved data from other areas.&lt;br /&gt;
&lt;br /&gt;
* Dedicated Forms for Each Section&lt;br /&gt;
** Implement separate forms for each tab using React Hook Form which enables efficient state management and robust schema-driven validations.&lt;br /&gt;
** Ensure that each form manages its own state and validation logic independently, avoiding interference between sections.&lt;br /&gt;
&lt;br /&gt;
* Enhanced User Experience &lt;br /&gt;
** Users will benefit from clear, compartmentalized UI sections, reducing cognitive load and streamlining the update process.&lt;br /&gt;
** Real-time validation and dedicated feedback per section will help prevent input errors and improve overall form usability.&lt;br /&gt;
&lt;br /&gt;
==== Proposed Wireframes ====&lt;br /&gt;
[[File:wireframes1.png|600px|Wireframe 1]]&lt;br /&gt;
[[File:wireframes2.png|600px|Wireframe 2]]&lt;br /&gt;
[[File:wireframes3.png|600px|Wireframe 3]]&lt;br /&gt;
[[File:wireframes4.png|600px|Wireframe 4]]&lt;br /&gt;
[[File:wireframes5.png|600px|Wireframe 5]]&lt;br /&gt;
&lt;br /&gt;
''Attached Wireframes are not to be mistaken as actual designs or the live application/website.''&lt;br /&gt;
&lt;br /&gt;
==== File Modifications ====&lt;br /&gt;
* Edit the existing code in [https://github.com/expertiza/reimplementation-front-end/blob/main/src/pages/Profile/Edit.tsx `src/pages/Profile/Edit.tsx`] to implement the new layout.&lt;br /&gt;
&lt;br /&gt;
=== Back-End ===&lt;br /&gt;
&lt;br /&gt;
The backend will be enhanced to support secure, RESTful profile and password updates, while incorporating session management and protection against attacks.&lt;br /&gt;
&lt;br /&gt;
==== User Model Enhancements ====&lt;br /&gt;
Add/update methods to: &lt;br /&gt;
* Safely update user profile fields (e.g., name, email)&lt;br /&gt;
* Change passwords using bcrypt for hashing&lt;br /&gt;
* Invalidate old sessions upon password update&lt;br /&gt;
&lt;br /&gt;
==== New API Endpoints ====&lt;br /&gt;
There are some of the proposed endpoints for the reimplementation.&lt;br /&gt;
* `GET /api/v1/profile` – Fetch current user details&lt;br /&gt;
* `PUT /api/v1/profile` – Update user profile&lt;br /&gt;
* `PUT /api/v1/profile/password` – Update password securely&lt;br /&gt;
&lt;br /&gt;
==== Session Management ====&lt;br /&gt;
* Log out all active sessions after a successful password change&lt;br /&gt;
* Revoke previous tokens to ensure account safety&lt;br /&gt;
&lt;br /&gt;
==== Security Measures ====&lt;br /&gt;
* Implement rate limiting with `Rack::Attack` to prevent brute-force attacks&lt;br /&gt;
* Return generic error messages for failed logins to avoid account enumeration&lt;br /&gt;
&lt;br /&gt;
==Database Changes==&lt;br /&gt;
&lt;br /&gt;
The existing `users` table currently includes all the necessary fields required for user profile management, such as name, email, and password. As of now, no immediate changes to the schema are required. However, during the implementation phase, if additional fields are identified as necessary, the schema will be updated accordingly. Any modifications to the schema will be thoroughly reviewed and documented to ensure they align with the project requirements and maintain data integrity.&lt;br /&gt;
&lt;br /&gt;
==Overview of Classes==&lt;br /&gt;
&lt;br /&gt;
=== UsersController (app/controllers/api/v1/users_controller.rb) ===&lt;br /&gt;
Will be extended to:&lt;br /&gt;
* `GET /profile`: Return current user details (JSON)&lt;br /&gt;
* `PUT /profile`: Update user attributes like name, email, notification preferences&lt;br /&gt;
&lt;br /&gt;
=== PasswordsController (app/controllers/api/v1/passwords_controller.rb) ===&lt;br /&gt;
Will handle secure password changes via:&lt;br /&gt;
* `PUT /password`:&lt;br /&gt;
** Authenticate using current password&lt;br /&gt;
** Update using bcrypt&lt;br /&gt;
** Invalidate old sessions/tokens&lt;br /&gt;
** Issue a new session token&lt;br /&gt;
&lt;br /&gt;
=== User Model (app/models/user.rb) ===&lt;br /&gt;
Updated to include:&lt;br /&gt;
* `update_profile(params)` method for secure profile updates&lt;br /&gt;
* `change_password(current_password, new_password)` with proper validations&lt;br /&gt;
* Session/token handling logic after password changes&lt;br /&gt;
&lt;br /&gt;
=== AuthenticationTokenService / Session Handler ===&lt;br /&gt;
* Issues new tokens upon password change&lt;br /&gt;
* Invalidates previous sessions to prevent unauthorized access&lt;br /&gt;
&lt;br /&gt;
=== ApplicationController ===&lt;br /&gt;
* Handles token-based authentication for API access&lt;br /&gt;
* Provides common methods for current user lookup and error handling&lt;br /&gt;
&lt;br /&gt;
=== Rack::Attack Configuration (config/initializers/rack_attack.rb) ===&lt;br /&gt;
* Implements rate limiting for profile and password update endpoints&lt;br /&gt;
* Helps mitigate brute-force and enumeration attacks&lt;br /&gt;
&lt;br /&gt;
=== Class Diagram ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:ClassDiagramE2535.png||Class Diagram]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&lt;br /&gt;
=== Usability &amp;amp; User Experience (UX) ===&lt;br /&gt;
* '''Intuitive Interface''': The user profile page should be easy to navigate with clear sections for updating profile information, changing passwords, and managing notifications. Each form will include:&lt;br /&gt;
** Informative tooltips and labels&lt;br /&gt;
** Clear error messages and success notifications&lt;br /&gt;
** Loading indicators to improve responsiveness&lt;br /&gt;
&lt;br /&gt;
* '''Responsive Design''': The profile page must be fully responsive across various devices, from desktops to mobile phones, ensuring an optimized experience for all users.&lt;br /&gt;
&lt;br /&gt;
* '''Smooth Transitions''': Using React Router, transitions between different sections (such as profile editing and password change) should feel seamless without page reloads, improving the overall user experience.&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
* '''Password Management'''&lt;br /&gt;
** Use bcrypt to hash passwords securely before saving them to the database.&lt;br /&gt;
** Implement token-based authentication for user sessions.&lt;br /&gt;
** When the password is updated, invalidate all active sessions and issue a new authentication token to prevent unauthorized access.&lt;br /&gt;
&lt;br /&gt;
* '''Rate Limiting''': To prevent brute-force attacks, rate limiting will be implemented on sensitive endpoints like the password change and login routes using Rack::Attack.&lt;br /&gt;
&lt;br /&gt;
* '''Account Enumeration Protection''': Return generic error messages on failed login attempts and password changes to prevent attackers from determining whether a username/email is valid.&lt;br /&gt;
&lt;br /&gt;
* '''Session Management''': When a password is successfully updated, ensure that all other active sessions are logged out and new tokens are issued to prevent session hijacking.&lt;br /&gt;
&lt;br /&gt;
=== Maintainability &amp;amp; Scalability ===&lt;br /&gt;
* '''Modular Codebase''': The code will follow a modular approach by breaking down functionality into smaller, reusable components (both frontend and backend). For example, the frontend components will be encapsulated, and the backend logic will be implemented using service objects where appropriate.&lt;br /&gt;
&lt;br /&gt;
* '''RESTful API Structure''': The backend will adhere to RESTful principles for API endpoints, ensuring that the architecture is scalable and easily extendable in the future. Common conventions like GET, PUT, and PATCH will be used for profile and password management.&lt;br /&gt;
&lt;br /&gt;
* '''Separation of Concerns''': The frontend and backend will be clearly separated with well-defined API contracts. The frontend will handle the presentation and user interactions, while the backend will focus on business logic and data persistence.&lt;br /&gt;
&lt;br /&gt;
* '''Testing and Quality Assurance''': Automated tests will be implemented to ensure the robustness of the system. RSpec will be used for backend testing, and Jest will be used for frontend testing.&lt;br /&gt;
&lt;br /&gt;
=== Code Quality ===&lt;br /&gt;
* '''Adhere to DRY Principles''': The code will avoid repetition by creating reusable components and centralized validation logic for both frontend and backend. For example, validation logic for user input will be shared between the frontend (React Hook Form validation) and the backend (model validations).&lt;br /&gt;
&lt;br /&gt;
* '''Consistent API Responses''': API responses will be standardized across endpoints to ensure a consistent interface for the frontend. This includes:&lt;br /&gt;
** Returning relevant HTTP status codes&lt;br /&gt;
** Structuring responses with consistent fields &lt;br /&gt;
&lt;br /&gt;
* '''Clear Documentation''': The documentation will be maintained, detailing endpoint routes, required parameters, expected responses, and error handling procedures.&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan  ==&lt;br /&gt;
&lt;br /&gt;
=== Frontend Implementation ===&lt;br /&gt;
* Create new React components&lt;br /&gt;
* Implement validation of form fields&lt;br /&gt;
* Connect to backend endpoints&lt;br /&gt;
* Add success/confirmation messages on profile updates&lt;br /&gt;
* Add loading states and error handling&lt;br /&gt;
* Implement responsive design&lt;br /&gt;
&lt;br /&gt;
=== Backend Implementation ===&lt;br /&gt;
* Update UserController with new endpoints&lt;br /&gt;
* Implement password security measures&lt;br /&gt;
* Add rate limiting functionality&lt;br /&gt;
* Update user model validation&lt;br /&gt;
* Implement session management&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frontend Implementation ===&lt;br /&gt;
The new UI redesign replicates the functionality of the original page, now leveraging TypeScript for type safety and React for dynamic rendering. This approach enhances the user experience by providing a more responsive and accessible interface, while adhering to modern design principles. This feature redesigns the Edit Profile page, implementing a modern, form-based interface using React, TypeScript, and React Hook Form, with full backend integration for real-time data fetch and update. The new UI focuses on form validation, user experience, and code maintainability.&lt;br /&gt;
&lt;br /&gt;
Key Features:&lt;br /&gt;
* Form Management: Uses `react-hook-form` and `yup` for structured form handling and ensuring reliable input checks and robust form validation&lt;br /&gt;
* Backend Integration: Profile data is fetched from the backend and is used to populate the form fields. On submission, this data is validated and triggers an API request to update profile and password (if the password is changed).&lt;br /&gt;
* UI Enhancements: Improved error handling and form usability. `Yup` validation checks data before it is sent to the backend, ensuring fast display of errors. The form also display success and error messages for API requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:FinalUI.png|600px|Final UI]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:FinalUI-Success.png|600px|Final UI]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:FinalUI-Failure.png|600px|Final UI]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Sequence Diagram ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:SequenceDiagram.png|600px|Sequence Diagram]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
=== Unit Tests ===&lt;br /&gt;
* '''Details''': Write tests to validate that the model validations are functioning correctly.&lt;br /&gt;
* '''Focus''': Ensure associations are set up properly (`belongs_to`, `has_many`), and no dangling records are left after CRUD operations.&lt;br /&gt;
&lt;br /&gt;
=== Functional Tests ===&lt;br /&gt;
* '''Details''': Use RSpec to test the behavior of the controllers.&lt;br /&gt;
* '''Focus''': Verify that the controllers correctly handle user input and update the database.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
* '''Details''': Validate the overall user experience.&lt;br /&gt;
* '''Focus''': Test UI layout, responsiveness, toggle functionality (password visibility), and the system's performance under normal usage.&lt;br /&gt;
&lt;br /&gt;
==Mentor==&lt;br /&gt;
&lt;br /&gt;
* [mailto:pkodali@ncsu.edu Prathyusha Kodali]&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
&lt;br /&gt;
* [mailto:dsaraog@ncsu.edu Devang Saraogi]&lt;br /&gt;
* [mailto:gsharma3@ncsu.edu Galav Sharma]&lt;br /&gt;
* [mailto:jshah23@ncsu.edu Jash Shah]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
* [https://expertiza.ncsu.edu/ Expertiza]&lt;br /&gt;
* [https://docs.google.com/document/d/1jjbqggRDiOHrxdsMlliY62JnP34bGTNHVWAZNz89kT8/edit?usp=sharing Final Projects on Expertiza]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-front-end Front-end Github]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-back-end Back-end Github]&lt;/div&gt;</summary>
		<author><name>Gsharma3</name></author>
	</entry>
</feed>