AmanNegi / FreshNest

A platform that connects local producers directly with consumers seeking fresh produce.
https://fresh-nest.netlify.app
GNU Affero General Public License v3.0
23 stars 39 forks source link

Enhance Error Handling and Implement Required Fields for Auth #136

Closed ayobamiseun closed 8 months ago

ayobamiseun commented 1 year ago

We have identified the need to enhance the error handling mechanism in our authentication system. Additionally, we need to implement required fields for authentication to ensure the security and usability of our application.

Error Handling Enhancement:

Currently, our application does not provide adequate error feedback to users during authentication. When authentication fails, users are not informed about the specific issue, which can lead to confusion and frustration.

Proposed Changes for Error Handling:

Implement clear and informative error messages for different authentication failure scenarios. Log errors on the server for debugging and monitoring purposes. Improve the user interface to display error messages prominently and guide users on how to resolve authentication issues.

Required Fields for Authentication:

To enhance the security of our authentication system, we need to ensure that certain fields are mandatory during the registration and login processes. This will help prevent incomplete or inaccurate user profiles and improve the overall user experience.

AmanNegi commented 1 year ago

@ayobamiseun This seems like a copy of https://github.com/AmanNegi/FreshNest/issues/125. Let me know if I am wrong.

ayobamiseun commented 1 year ago

@ayobamiseun This seems like a copy of #125. Let me know if I am wrong.

i just checked, it's same thing. i will just wait for it to be implemented cause it has not yet been done.

AmanNegi commented 1 year ago

@ayobamiseun While that issue is about frontend validation, we still have an error in the backend. If you want you can work on it and update this issue.

Basically, the issue is that when Node.js returns a 400 response code our React frontend throws an error. To avoid this issue we use the function getErrorResponse, which returns a 200 response but has a status code and error message inside the body. It seems that when an error is found we are directly returning a 400 response code which is causing the issue and we are not getting a toast on the front-end side.

TODO's:

Reference:

Smajdalf530 commented 1 year ago

Hi, could you please assign this issue to me ?

ayobamiseun commented 1 year ago

let me

@ayobamiseun While that issue is about frontend validation, we still have an error in the backend. If you want you can work on it and update this issue.

Basically, the issue is that when Node.js returns a 400 response code our React frontend throws an error. To avoid this issue we use the function getErrorResponse, which returns a 200 response but has a status code and error message inside the body. It seems that when an error is found we are directly returning a 400 response code which is causing the issue and we are not getting a toast on the front-end side.

TODO's:

  • [ ] Replace all res.status(400) or res.status(200) with appropriate functions getErrorResponse or getSuccessResponse.

Reference:

I believe I've already resolved this issue, but I'm unable to test it because I can't use the local API route due to CORS issues

@ayobamiseun While that issue is about frontend validation, we still have an error in the backend. If you want you can work on it and update this issue.

Basically, the issue is that when Node.js returns a 400 response code our React frontend throws an error. To avoid this issue we use the function getErrorResponse, which returns a 200 response but has a status code and error message inside the body. It seems that when an error is found we are directly returning a 400 response code which is causing the issue and we are not getting a toast on the front-end side.

TODO's:

  • [ ] Replace all res.status(400) or res.status(200) with appropriate functions getErrorResponse or getSuccessResponse.

Reference:

I believe I've already resolved this issue, but I'm unable to test it because I can't use the local API route due to CORS issues. you can check my PR