Closed max-out-oluwadara closed 2 weeks ago
{
"message": "Password updated successfully.",
"status_code": 200
}
{
"message": "Invalid input or token",
"status_code": 400
}
{
"message": "User not found",
"status_code": 404
}
{
"message": "Server error during processing.",
"status_code": 500
}
@Ayobamidele thanks, have update the test
Why you close it initially??
Why is token in request body instead of request header?
@Shullyd7 Have make the necessary adjustment sir... please help recheck
@phurhard it open now sir.. it a mistake
A question is asked why, and you just went ahead to change it to headers. Okay, why is the Authtoken in headers?? Is a user signed in before they can reset the password?? Or the token is given to client without signing in??
It is required for security purposes, so a token must always be generated to verify the process of resetting the password. wherever the user is logged in or not
I know why a token is needed, I'm asking you if you know why you're putting it in the header or body. The token needed is it the JWT token or it's the confirmation token sent to the user's mail.
The confirmation token is sent to the user's mail.
So how would the user send that confirmation mail in the header??
Corrected sir, It would be in the body.
@phurhard
Have put it into two steps sir
One the user email is verified first. if user is found reset email is sent if user is not found appropriate error response and code is send
two the user click on the link in the email... the link will contain the token and it take the user to the page where the new email will be post to the database. With the approperiate response thanks
@phurhard @Shullyd7 @markessien
The frontend will extract the token sir
headers: { 'Content-Type': 'application/json', 'X-Reset-Token': token }
From the url params example https://example.com/reset-password?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9......
Description
Develop an endpoint to handle requests to reset password for registered users. If the password reset is successfully, it will be returned to the client with a '200' status. If an error occurs, an appropriate error status will be returned.
Acceptance Criteria
200
status code and the correct response body when password is successfully updated and hashed into the database.404
status code and the correct response body when user is not found.Purpose
Implement endpoints to facilitate secure password updates for users who have forgotten their passwords or suspect their credentials have been compromised.
Requirement
Expected Outcome
STEP 1
Endpoints
[POST] /api/v1/request-password-request
Description: Initiates the password reset process by verifying the user's email and sending a reset token.
Request
Header
Content-Type: application/json
Body
Response
Success (200 OK)
Error Response If user cant be found (400 Bad Request)
Server-side error(500 Internal Server Error)
Content-Type: application/json X-Reset-Token:
{ "new_password": "string" }
{ "message": "Password updated successfully.", "status_code": 200 }
{ "message": "Invalid input or token", "status_code": 400 }
{ "message": "Server error during processing.", "status_code": 500, }
{ "message": "Password updated successfully.", "status_code": 200 }
{ "message": "Invalid input or token", "status_code": 400 }
{ "message": "User not found", "status_code": 404 }
{ "message": "Server error during processing.", "status_code": 500 }