Sunagatov / Iced-Latte

a online Marketplace for coffee retail (Backend)
https://iced-latte.uk
MIT License
610 stars 115 forks source link

Reset password with invalid mask email. Unclear error message and HTTP status code 401 #272

Open TetianaPerinha opened 7 months ago

TetianaPerinha commented 7 months ago

Description: According to the requirements when user sends a request to reset the password with an invalid format/mask email user should get a clear error message.

Step to reproduce:

Sent POST request as below:

curl --location 'http://0.0.0.0:8083/api/v1/auth/password/change' --header 'Content-Type: application/json' --data-raw '{ "email": "@‌gmail.com", "code": "123-123-123", "password": "password12345" }'

Expected result: "Email must be valid" and HTTP CODE = 400 ‘Bad request’

Actual result: "message": "User with id = null is not found.", and HTTP Status CODE = 401Unauthorized

image

DarsiSreelekha commented 6 months ago

hey @TetianaPerinha I would like to pick this issue , would you please assign it to me

TetianaPerinha commented 6 months ago

hey @TetianaPerinha I would like to pick this issue , would you please assign it to me

Hey @DarsiSreelekha, I've assigned this task to you. If you have any questions, feel free to ask.

DarsiSreelekha commented 6 months ago

Hey @TetianaPerinha The above change would also effect the http://0.0.0.0:8083/api/v1/auth/password/forgot as internally both are using the same method that throws the same error. Since it is the same case I think it should be valid to have this change for this api as well. Attached below is the updated API response for the above.

image
TetianaPerinha commented 6 months ago

Hey @TetianaPerinha The above change would also effect the http://0.0.0.0:8083/api/v1/auth/password/forgot as internally both are using the same method that throws the same error. Since it is the same case I think it should be valid to have this change for this api as well. Attached below is the updated API response for the above.

image

@Sunagatov Could you please review the details of this task?