fix: auth otp flow + remove generated

This commit is contained in:
SauravDhakal
2026-04-05 16:19:19 +05:45
parent 4905c6f1d1
commit ab8b2ef353
27 changed files with 340 additions and 8425 deletions

View File

@@ -1,3 +1,141 @@
export const authOTP = (otp: number) => (
`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Verification Code</title>
<style>
body{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background:#f4f7fb;
margin:0;
padding:0;
color:#374151;
}
.container{
max-width:600px;
margin:40px auto;
background:#ffffff;
border-radius:10px;
padding:40px;
box-shadow:0 8px 25px rgba(0,0,0,0.05);
}
.logo{
text-align:center;
font-size:24px;
font-weight:700;
color:#2563eb;
margin-bottom:30px;
}
h1{
font-size:22px;
margin-bottom:10px;
color:#111827;
}
p{
font-size:15px;
color:#4b5563;
line-height:1.6;
}
.otp-box{
margin:35px 0;
text-align:center;
}
.otp{
display:inline-block;
font-size:32px;
letter-spacing:8px;
font-weight:700;
background:#f1f5ff;
color:#1d4ed8;
padding:18px 30px;
border-radius:8px;
}
.expiry{
margin-top:12px;
font-size:13px;
color:#6b7280;
}
.warning{
margin-top:20px;
font-size:13px;
color:#6b7280;
background:#f9fafb;
padding:12px;
border-radius:6px;
}
.footer{
text-align:center;
font-size:12px;
color:#9ca3af;
margin-top:35px;
}
.divider{
height:1px;
background:#e5e7eb;
margin:30px 0;
}
</style>
</head>
<body>
<div class="container">
<div class="logo">MultiTenant SaaS</div>
<h1>Your Verification Code</h1>
<p>Hello,</p>
<p>
Use the following One-Time Password (OTP) to continue signing in to your
<strong>MultiTenant SaaS</strong> account.
</p>
<div class="otp-box">
<div class="otp">${otp}</div>
<div class="expiry">This code is valid for <strong>5 minutes</strong> only.</div>
</div>
<p>
Enter this code in the verification screen to complete your login or signup.
</p>
<div class="warning">
For security reasons, never share this code with anyone. Our team will never ask you for your OTP.
</div>
<div class="divider"></div>
<p>
If you did not request this code, you can safely ignore this email.
</p>
<div class="footer">
© 2026 MultiTenant SaaS. All rights reserved.
</div>
</div>
</body>
</html>
`
)
export const welcomeToApp =
`
<!DOCTYPE html>

View File

@@ -1,6 +1,10 @@
import { welcomeToApp } from "./auth"
import { welcomeToApp, authOTP } from "./auth"
const EmailTemplates = {
signup_otp: (otp: number) => ({
subject: "Your MultiTenant SaaS Verification Code",
body: authOTP(otp)
}),
signup_completed: {
subject: "Welcome to app",
body: welcomeToApp