final flows including emails for passwords
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { Resend } from 'resend';
|
||||
import { RESEND_API } from '$app/env/private';
|
||||
|
||||
const resend = new Resend(String(RESEND_API));
|
||||
|
||||
export async function sendPasswordResetEmail(opts: {
|
||||
to: string;
|
||||
resetLink: string;
|
||||
famName: string;
|
||||
}) {
|
||||
const { to, resetLink, famName } = opts;
|
||||
|
||||
await resend.emails.send({
|
||||
from: 'no-reply@famchamp.ai',
|
||||
to,
|
||||
subject: `Reset your password for ${famName}`,
|
||||
html: `
|
||||
<p>You requested a password reset for your <strong>${famName}</strong> account.</p>
|
||||
<p><a href="${resetLink}">Click here to reset your password</a></p>
|
||||
<p>This link expires in 1 hour.</p>
|
||||
<p>If you didn't request this, you can ignore this email.</p>
|
||||
`
|
||||
});
|
||||
}
|
||||
|
||||
export async function sendParentInviteEmail(opts: {
|
||||
to: string;
|
||||
inviteLink: string;
|
||||
famName: string;
|
||||
otp: string;
|
||||
}) {
|
||||
const { to, inviteLink, famName, otp } = opts;
|
||||
|
||||
await resend.emails.send({
|
||||
from: 'no-reply@famchamp.ai',
|
||||
to,
|
||||
subject: `You're invited to ${famName} on FamChore`,
|
||||
html: `
|
||||
<p>You've been invited as a parent on <strong>${famName}</strong>.</p>
|
||||
<p><a href="${inviteLink}">Click here to join</a> and set up your password.</p>
|
||||
<p>Your code is <strong>${otp}</strong> (valid 20 minutes).</p>
|
||||
<p>If you weren't expecting this, you can ignore this email.</p>
|
||||
`
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user