Files
spotlightcam/backend/src/emails/templates/verification.js

96 lines
3.6 KiB
JavaScript
Raw Normal View History

/**
* Email template for email verification
* Sends verification link and PIN code to new users
*/
/**
* Generate verification email content
* @param {Object} data - Template data
* @param {string} data.firstName - User's first name
* @param {string} data.verificationLink - Full verification URL with token
* @param {string} data.verificationCode - 6-digit PIN code
* @returns {Object} - Email content with subject, htmlBody, textBody
*/
function generateVerificationEmail(data) {
const { firstName, verificationLink, verificationCode } = data;
const subject = 'Verify your spotlight.cam email';
const htmlBody = `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.6; color: #333; }
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
.header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center; border-radius: 8px 8px 0 0; }
.content { background: #f9fafb; padding: 30px; border-radius: 0 0 8px 8px; }
.code-box { background: white; border: 2px solid #667eea; border-radius: 8px; padding: 20px; text-align: center; margin: 20px 0; }
.code { font-size: 32px; font-weight: bold; letter-spacing: 8px; color: #667eea; font-family: monospace; }
.button { display: inline-block; background: #667eea; color: white; padding: 14px 30px; text-decoration: none; border-radius: 6px; margin: 20px 0; font-weight: 600; }
.footer { text-align: center; color: #666; font-size: 14px; margin-top: 30px; }
.divider { border-top: 1px solid #e5e7eb; margin: 20px 0; }
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🎥 spotlight.cam</h1>
<p>Welcome to the dance community!</p>
</div>
<div class="content">
<h2>Hi ${firstName || 'there'}! 👋</h2>
<p>Thanks for joining spotlight.cam! To start sharing dance videos with your event partners, please verify your email address.</p>
<h3>Option 1: Click the button</h3>
<a href="${verificationLink}" class="button">Verify Email Address</a>
<div class="divider"></div>
<h3>Option 2: Enter this code</h3>
<div class="code-box">
<div class="code">${verificationCode}</div>
</div>
<p style="font-size: 14px; color: #666;">This code will expire in 24 hours.</p>
<div class="divider"></div>
<p><strong>Didn't create an account?</strong> You can safely ignore this email.</p>
</div>
<div class="footer">
<p>spotlight.cam - P2P video exchange for dance events</p>
<p>This is an automated email. Please do not reply.</p>
</div>
</div>
</body>
</html>
`;
const textBody = `
Hi ${firstName || 'there'}!
Thanks for joining spotlight.cam! To start sharing dance videos with your event partners, please verify your email address.
Option 1: Click this link to verify
${verificationLink}
Option 2: Enter this verification code
${verificationCode}
This code will expire in 24 hours.
Didn't create an account? You can safely ignore this email.
---
spotlight.cam - P2P video exchange for dance events
This is an automated email. Please do not reply.
`;
return { subject, htmlBody, textBody };
}
module.exports = { generateVerificationEmail };