Add display_name argument for greeting in password reset emails

Co-authored-by: nitnelave <796633+nitnelave@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-09-04 22:50:32 +00:00
parent c400fac481
commit f1d0c400aa
2 changed files with 8 additions and 1 deletions
+1
View File
@@ -186,6 +186,7 @@ where
Some(token) => token,
};
if let Err(e) = super::mail::send_password_reset_email(
user.display_name.as_deref(),
user.user_id.as_str(),
user.email.as_str(),
&token,
+7 -1
View File
@@ -80,6 +80,7 @@ async fn send_email(
}
pub async fn send_password_reset_email(
display_name: Option<&str>,
username: &str,
to: &str,
token: &str,
@@ -92,8 +93,13 @@ pub async fn send_password_reset_email(
.path_segments_mut()
.unwrap()
.extend(["reset-password", "step2", token]);
let greeting = match display_name {
Some(name) if !name.is_empty() => format!("Hello {name},"),
_ => format!("Hello {username},"),
};
let body = format!(
"Hello {username},
"{greeting}
This email has been sent to you in order to validate your identity.
If you did not initiate the process your credentials might have been
compromised. You should reset your password and contact an administrator.