Add forgot-password and reset-password flow
Users can now request a password reset link via email. Better Auth sendResetPassword callback sends a branded email via Resend. Login page shows success notice after password is set. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -189,3 +189,19 @@ export async function sendTestEmail(to: string) {
|
||||
`, school),
|
||||
}).catch((e) => console.error("[email] sendTestEmail:", e));
|
||||
}
|
||||
|
||||
export async function sendPasswordResetEmail(to: string, name: string, resetUrl: string) {
|
||||
const school = await getSchoolName();
|
||||
await getResend().emails.send({
|
||||
from: FROM,
|
||||
to,
|
||||
subject: `Сброс пароля — ${school}`,
|
||||
html: base(`
|
||||
<p ${p}>Привет, ${name}!</p>
|
||||
<p ${p}>Вы запросили сброс пароля для вашего аккаунта на платформе <strong>${school}</strong>.</p>
|
||||
<p ${p}>Нажмите на кнопку ниже чтобы задать новый пароль. Ссылка действительна <strong>1 час</strong>.</p>
|
||||
<p ${pLast}>Если вы не запрашивали сброс — просто проигнорируйте это письмо.</p>
|
||||
${btn(resetUrl, "Задать новый пароль")}
|
||||
`, school),
|
||||
}).catch((e) => console.error("[email] sendPasswordResetEmail:", e));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user