pub fn forgot_password(
db: &Database,
item: &ForgotInput,
mailer: &Mailer,
) -> Result<(), (u16, &'static str)>
Expand description
/forgot
sends an email to the email in the ForgotInput
Json in the request body
that will allow the user associated with that email to change their password
sends an email, using mailer
, to the email address in item
that contains a unique link that allows the recipient to reset the password
of the account associated with that email address (or create a new account if there is
no accound accosiated with the email address)
§Errors
- None
§Panics
- could not connect to database
- current timestamp could not be converted from
i64
tousize
- could not get
SECRET_KEY
from environment
TODO: don’t panic if db connection fails, just return an error