mirasoldavila13 / NeighborhoodAid

NeighborhoodAid is an interactive platform designed to empower communities by enabling users to report local issues like potholes, vandalism, and streetlight outages.
MIT License
0 stars 0 forks source link

User Registration #1

Closed mirasoldavila13 closed 1 month ago

mirasoldavila13 commented 1 month ago

User Story:

AS A new user I WANT TO register an account
SO THAT I can report issues, and track them

Acceptance Criteria:

  1. The user should be able to input a name, email, and password.
  2. The system should validate the input
  3. The user should receive a confirmation upon successful registration.

Tasks:

mirasoldavila13 commented 1 month ago

GitHub Issue 1: User Registration Implementation

What I’ve Done:

Created the registration form (UserRegistration.tsx):
Added input fields for the user's name, email, and password. Also included input validation to ensure all fields are filled out, the email is valid, and the password meets the minimum length requirement.

Implemented input validation:
Ensured all fields are validated in the frontend before submission. If the fields don’t pass validation (e.g., password length, email format), the user receives an appropriate message.

Created the API route for user registration (authController.js):
Set up the /api/register route to handle user registration on the server side. This checks if a user already exists, hashes the password, and saves the user to the database.

Password hashing (authController.js):
Used bcrypt to hash the user’s password before saving it to the database. This ensures secure storage of user credentials.

Success and failure response handling:
Depending on whether registration was successful or not, appropriate success or error messages are returned to the frontend.

Updated database model (user.js and migrations/20240930070559-create-user.js):
Created the User model with name, email, and password fields, ensuring that both email and name are required.

Files Updated:

Frontend:
    UserRegistration.tsx – Form, validation, and submission logic.
Backend:
    authController.js – Logic for handling registration and password hashing.
    user.js – Sequelize User model for storing user details in the database.
    migrations/20240930070559-create-user.js – Migration for setting up the User model in the database.

What’s Left to Do:

This issue is complete. Registration works end-to-end with validation, password hashing, and appropriate responses sent back to the frontend