ugh
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 3m24s

This commit is contained in:
2025-12-02 16:47:51 -08:00
parent 80e2222d20
commit fedd1c9656

View File

@@ -91,4 +91,35 @@ export const sendDealNotificationEmail = async (to: string, name: string | null,
text,
html,
});
};
/**
* Sends a password reset email to a user containing a link with their reset token.
* @param to The recipient's email address.
* @param token The unique password reset token.
*/
export const sendPasswordResetEmail = async (to: string, token: string) => {
const subject = 'Your Password Reset Request';
// Construct the full reset URL using the frontend base URL from environment variables.
const resetUrl = `${process.env.FRONTEND_URL}/reset-password?token=${token}`;
const html = `
<div style="font-family: sans-serif; padding: 20px;">
<h2>Password Reset Request</h2>
<p>You requested a password reset for your Flyer Crawler account.</p>
<p>Please click the link below to set a new password. This link will expire in 1 hour.</p>
<a href="${resetUrl}" style="background-color: #007bff; color: white; padding: 14px 25px; text-align: center; text-decoration: none; display: inline-block; border-radius: 5px;">Reset Your Password</a>
<p style="margin-top: 20px;">If you did not request this, please ignore this email.</p>
</div>
`;
const text = `Password Reset Request\n\nYou requested a password reset for your Flyer Crawler account.\nPlease use the following link to set a new password: ${resetUrl}\nThis link will expire in 1 hour.\n\nIf you did not request this, please ignore this email.`;
// Use the generic sendEmail function to send the composed email.
await sendEmail({
to,
subject,
text,
html,
});
};