Password Reset Post
/api/v2/user/password/reset
Post
users
Purpose
To allow a registered user to reset his / her password.
URL Parameters [input]
{
username: string,
token: string,
password: string
}
Returns if valid [output]
{
message: string,
error: 0
}
What the API does
- Checks if there is a record in the
userscollection with theusernamesupplied [404]. - Checks if the value of the
resetfield of the fetched record has a value oftrue[403]. - Checks if the
tokensupplied is valid and corresponds to the one saved in the fetched record [401]. - Checks if the
passwordsupplied contains at least 1 lowercase alphabet, 1 uppercase alphabet, 1 numerical character and that it is at least 8 characters long [400]. - Sends a mail to the email address corresponding to the value of the
prev_emailfield of the found record to inform the user that his/her password has just been reset. - Updates and saves the
userscollection by setting theresetfield tofalse, thetokenfield to an empty string and thepasswordfield to a hashed version of the one supplied for the record corresponding to the value of theusernamefield provided.