Function change_password

Source
pub fn change_password(
    db: &Database,
    item: &ChangeInput,
    auth: &Auth,
    mailer: &Mailer,
) -> Result<(), (u16, &'static str)>
Expand description

/change

change the password of the User associated with auth from item.old_password to item.new_password

§Errors

  • 400: Missing password
  • 400: The new password must be different
  • 400: Account has not been activated
  • 401: Invalid credentials
  • 500: Could not update password
  • 500: Could not find user

§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