Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ pub fn send_verification_code(cfg: &Mail, to: &str, code: &str) -> Result<()> {
.port(cfg.smtp_port)
.credentials(creds)
.build();
mailer
.send(&email)
.map_err(|e| {
log::error!("SMTP 发送验证码到 {to} 失败: {e:?}");
anyhow::anyhow!("发送验证码到 {to} 失败: {e}")
})?;
mailer.send(&email).map_err(|e| {
log::error!("SMTP 发送验证码到 {to} 失败: {e:?}");
anyhow::anyhow!("发送验证码到 {to} 失败: {e}")
})?;
log::info!("验证码邮件已发送: {to}");
Ok(())
}
7 changes: 5 additions & 2 deletions src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,8 +1288,11 @@ mod tests {
// 清掉限频记录(直接操作 DB,测试辅助)→ 再 forgot 发码
{
let conn = st.db.lock().unwrap();
conn.execute("DELETE FROM email_verifications WHERE email = 'reset@example.com'", [])
.unwrap();
conn.execute(
"DELETE FROM email_verifications WHERE email = 'reset@example.com'",
[],
)
.unwrap();
}
let (s, body) = post(
st.clone(),
Expand Down
Loading