From fedd1c9656b517f52f39c550fbe6c8bf69f92734 Mon Sep 17 00:00:00 2001 From: Torben Sorensen Date: Tue, 2 Dec 2025 16:47:51 -0800 Subject: [PATCH] ugh --- src/services/emailService.server.ts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/services/emailService.server.ts b/src/services/emailService.server.ts index 1faafc5f..02508a2c 100644 --- a/src/services/emailService.server.ts +++ b/src/services/emailService.server.ts @@ -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 = ` +
+

Password Reset Request

+

You requested a password reset for your Flyer Crawler account.

+

Please click the link below to set a new password. This link will expire in 1 hour.

+ Reset Your Password +

If you did not request this, please ignore this email.

+
+ `; + + 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, + }); }; \ No newline at end of file