Function reset_password

Source
pub fn reset_password(
    db: &Database,
    item: &ResetInput,
    mailer: &Mailer,
) -> Result<(), (u16, &'static str)>
Expand description

reset

changes the password of the user associated with item.reset_token to item.new_password

§Errors

  • 400: Missing password
  • 401: Invalid token
  • 400: Invalid token
  • 400: Account has not been activated
  • 500: Could not update password

§Panics

  • could not connect to database
  • could not get SECRET_KEY from environment

TODO: don’t panic if db connection fails, just return an error