Skip to content

Commit 20d8bf8

Browse files
committed
fix(auth): OTP verification format change
1 parent b481386 commit 20d8bf8

1 file changed

Lines changed: 44 additions & 2 deletions

File tree

src/services/otp.service.js

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,53 @@ export const sendOTPEmail = async (email, otp) => {
1111
await brevoEmailClient.sendTransacEmail({
1212
sender: { email: process.env.BREVO_SENDER_EMAIL },
1313
to: [{ email }],
14-
subject: 'Your OTP Code',
15-
htmlContent: `<h2>Your OTP is: ${otp}</h2><p>Valid for ${process.env.OTP_EXPIRE_MINUTES} minutes.</p>`
14+
subject: 'Your One-Time Password (OTP) – Secure Verification',
15+
htmlContent: `
16+
<div style="font-family: Arial, sans-serif; background-color: #f4f6f8; padding: 20px;">
17+
<div style="max-width: 600px; margin: 0 auto; background-color: #ffffff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05);">
18+
19+
<h2 style="color: #333333; margin-bottom: 10px;">Verification Required</h2>
20+
21+
<p style="color: #555555; font-size: 14px; line-height: 1.6;">
22+
Dear User,
23+
</p>
24+
25+
<p style="color: #555555; font-size: 14px; line-height: 1.6;">
26+
We received a request to verify your identity. Please use the One-Time Password (OTP) below to proceed:
27+
</p>
28+
29+
<div style="text-align: center; margin: 25px 0;">
30+
<span style="display: inline-block; font-size: 28px; font-weight: bold; letter-spacing: 4px; color: #1a73e8; background-color: #f1f3f4; padding: 12px 24px; border-radius: 6px;">
31+
${otp}
32+
</span>
33+
</div>
34+
35+
<p style="color: #555555; font-size: 14px; line-height: 1.6;">
36+
This OTP is valid for <strong>${process.env.OTP_EXPIRE_MINUTES} minutes</strong>.
37+
For security reasons, please do not share this code with anyone.
38+
</p>
39+
40+
<p style="color: #555555; font-size: 14px; line-height: 1.6;">
41+
If you did not request this verification, you may safely ignore this email.
42+
</p>
43+
44+
<hr style="border: none; border-top: 1px solid #eeeeee; margin: 30px 0;" />
45+
46+
<p style="color: #888888; font-size: 12px; line-height: 1.5;">
47+
This is an automated message. Please do not reply to this email.
48+
</p>
49+
50+
<p style="color: #888888; font-size: 12px;">
51+
© ${new Date().getFullYear()} HMS Team. All rights reserved.
52+
</p>
53+
54+
</div>
55+
</div>
56+
`
1657
});
1758
};
1859

60+
1961
export const createAndSendOTP = async (email) => {
2062
const otp = generateOTP();
2163
const hashedOTP = await bcrypt.hash(otp, 10);

0 commit comments

Comments
 (0)