This pull request addresses the implementation of user authentication on the backend, including the login and registration functionality. During testing, issues were identified with both the login and registration processes on the server, which have now been fixed. The following updates and fixes were made:
Tasks Completed:
Login:
Fixed the login issue on the server that was causing authentication failures.
Stored the received JWT securely in local storage.
Register:
Resolved the issue with the registration endpoint that was retuning invalid email or password:
Ensured successful user registration and token generation.
Store token in a cookie
Token Management:
Securely stored the authentication tokens (JWT) in lcookies after successful login or registration.
Files Changed:
server/controllers/userController.js: Fixed login request and token storage logic.
server/controllers/userController.js: Fixed registration flow and error handling.
server/controllers/authController.js: Fixed the login and registration logic to properly handle user authentication and token generation.
server/routes/authRoutes.js: Updated to handle registration and login flows correctly.
Testing:
Manual testing was performed to ensure:
The login functionality works correctly and returns a JWT token.
The registration functionality is fixed and works as expected.
Tokens are stored securely in local storage or cookies.
Add userController.test.js to test the authentication
Description:
This pull request addresses the implementation of user authentication on the backend, including the login and registration functionality. During testing, issues were identified with both the login and registration processes on the server, which have now been fixed. The following updates and fixes were made:
Tasks Completed:
Login:
Register:
Token Management:
Files Changed:
server/controllers/userController.js
: Fixed login request and token storage logic.server/controllers/userController.js
: Fixed registration flow and error handling.server/controllers/authController.js
: Fixed the login and registration logic to properly handle user authentication and token generation.server/routes/authRoutes.js
: Updated to handle registration and login flows correctly.Testing:
Add userController.test.js to test the authentication