All files / src/lib/email/templates resetPasswordEmailTemplate.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64                                  1x 1x                                                     1x   1x                           1x    
import {
  emailButton,
  emailContent,
  emailDivider,
  emailHeader,
  emailLayout,
  emailLink,
  emailParagraph,
  emailSmallText,
  emailWarningBox,
} from './shared/emailComponents';
 
/**
 * Password reset email template
 * @param resetUrl - The URL for resetting the password
 * @returns HTML and plain text email content
 */
export const resetPasswordEmailTemplate = (resetUrl: string) => {
  const content = `
    ${emailHeader('Password Reset Request')}
    
    ${emailContent(`
      ${emailParagraph('Hello,')}
      
      ${emailParagraph('You requested to reset your password. Click the button below to set a new password:')}
      
      <div style="text-align: center; margin: 30px 0;">
        ${emailButton('Reset Password', resetUrl)}
      </div>
      
      ${emailSmallText("If the button doesn't work, copy and paste this link into your browser:")}
      ${emailLink(resetUrl)}
      
      ${emailWarningBox('This link will expire in 1 hour for security reasons.')}
      
      ${emailSmallText("If you didn't request a password reset, please ignore this email and your password will remain unchanged.")}
      
      ${emailDivider()}
      
      <p style="font-size: 12px; color: #999; text-align: center; margin: 0;">
        This is an automated message, please do not reply to this email.
      </p>
    `)}
  `;
 
  const html = emailLayout(content);
 
  const text = `
    Password Reset Request
    
    Hello,
    
    You requested to reset your password. Click the link below to set a new password:
    
    ${resetUrl}
    
    Important: This link will expire in 1 hour for security reasons.
    
    If you didn't request a password reset, please ignore this email and your password will remain unchanged.
  `;
 
  return { html, text };
};