SaranshBangar / Daneizo

Why buy when you can rent it!
https://daneizo.vercel.app/
MIT License
26 stars 45 forks source link

Implement Backend Logic for Login and Registration ✨ #52

Open SurajSakhare100 opened 3 weeks ago

SurajSakhare100 commented 3 weeks ago

Description:

We need to implement the backend logic for user authentication, specifically for the login and registration functionalities. This will include setting up routes, controllers, and database interactions to ensure users can create accounts and log in securely.

Tasks:

Set Up Routes:

Create /api/auth/register route for user registration. Create /api/auth/login route for user login.

Registration Logic:

Validate incoming registration data (e.g., username, email, password). Hash the password before saving it to the database. Store user details in the database. Return a success message or error response.

Login Logic:

Validate incoming login data (e.g., email, password). Compare the hashed password with the stored hash. Generate a JWT token upon successful authentication. Return the token and user information or an error response. Security Measures:

Implement password hashing using bcrypt or a similar library. Set up JWT for token generation and validation.

@SaranshBangar Can you assign it to me under GSSoC, Hacktoberfest

SaranshBangar commented 3 weeks ago

Sure @SurajSakhare100 please check PR #18 before raising any of your to avoid merge conflicts

SurajSakhare100 commented 3 weeks ago

Implement Backend Logic for Login and Registration

https://github.com/user-attachments/assets/5bda50c8-d1b4-4485-94b5-43dc9dc4dddb

I've completed the backend part of the sign-up and login. I used MongoDB for the database. You can add your MongoURI to the .env file. If there are any further improvements or changes you'd like, please let me know and I can take care of it. If everything looks good, @SaranshBangar may I submit a PR?

SaranshBangar commented 3 weeks ago

@SurajSakhare100 Sure, you can raise the PR