Add a way to reset password

This commit is contained in:
Greg Burri 2024-11-09 11:22:53 +01:00
parent 5d343c273f
commit ed979719b5
12 changed files with 352 additions and 57 deletions

View file

@ -32,10 +32,9 @@ impl From<lettre::error::Error> for Error {
}
}
pub async fn send_validation(
site_url: &str,
pub async fn send_email(
email: &str,
token: &str,
message: &str,
smtp_relay_address: &str,
smtp_login: &str,
smtp_password: &str,
@ -45,10 +44,7 @@ pub async fn send_validation(
.from("recipes@gburri.org".parse()?)
.to(email.parse()?)
.subject("recipes.gburri.org account validation")
.body(format!(
"Follow this link to confirm your inscription: {}/validation?validation_token={}",
site_url, token
))?;
.body(message.to_string())?;
let credentials = Credentials::new(smtp_login.to_string(), smtp_password.to_string());