Link Search Menu Expand Document

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 users collection with the username supplied [404].
  • Checks if the value of the reset field of the fetched record has a value of true [403].
  • Checks if the token supplied is valid and corresponds to the one saved in the fetched record [401].
  • Checks if the password supplied 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_email field of the found record to inform the user that his/her password has just been reset.
  • Updates and saves the users collection by setting the reset field to false, the token field to an empty string and the password field to a hashed version of the one supplied for the record corresponding to the value of the username field provided.