🐐
This commit is contained in:
27
backend/email_utils.py
Normal file
27
backend/email_utils.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import resend
|
||||
import os
|
||||
from config import RESEND_API_KEY, EMAIL_FROM, FRONTEND_URL
|
||||
|
||||
def send_password_reset_email(to_email: str, username: str, reset_token: str):
|
||||
resend.api_key = RESEND_API_KEY
|
||||
reset_url = f"{FRONTEND_URL}/forgot-password/reset?token={reset_token}"
|
||||
|
||||
resend.Emails.send({
|
||||
"from": EMAIL_FROM,
|
||||
"to": to_email,
|
||||
"subject": "Reset your WikiTCG password",
|
||||
"html": f"""
|
||||
<div style="font-family: serif; max-width: 480px; margin: 0 auto; color: #1a1208;">
|
||||
<h2 style="color: #b87830;">WikiTCG Password Reset</h2>
|
||||
<p>Hi {username},</p>
|
||||
<p>Someone requested a password reset for your account. If this was you, click the link below:</p>
|
||||
<p style="margin: 2rem 0;">
|
||||
<a href="{reset_url}" style="background: #c8861a; color: #fff8e0; padding: 10px 24px; border-radius: 6px; text-decoration: none; font-family: sans-serif; font-size: 14px;">
|
||||
Reset Password
|
||||
</a>
|
||||
</p>
|
||||
<p>This link expires in 1 hour. If you didn't request this, you can safely ignore this email.</p>
|
||||
<p style="color: #888; font-size: 13px;">— WikiTCG</p>
|
||||
</div>
|
||||
""",
|
||||
})
|
||||
Reference in New Issue
Block a user