mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-15 08:25:01 +02:00
add otp flow to resource auth portal
This commit is contained in:
parent
d3d2fe398b
commit
998fab6d0a
14 changed files with 1159 additions and 376 deletions
|
@ -9,7 +9,7 @@ import { VerifyEmail } from "@server/emails/templates/VerifyEmailCode";
|
|||
|
||||
export async function sendEmailVerificationCode(
|
||||
email: string,
|
||||
userId: string,
|
||||
userId: string
|
||||
): Promise<void> {
|
||||
const code = await generateEmailVerificationCode(userId, email);
|
||||
|
||||
|
@ -17,19 +17,19 @@ export async function sendEmailVerificationCode(
|
|||
VerifyEmail({
|
||||
username: email,
|
||||
verificationCode: code,
|
||||
verifyLink: `${config.app.base_url}/auth/verify-email`,
|
||||
verifyLink: `${config.app.base_url}/auth/verify-email`
|
||||
}),
|
||||
{
|
||||
to: email,
|
||||
from: config.email?.no_reply,
|
||||
subject: "Verify your email address",
|
||||
},
|
||||
subject: "Verify your email address"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function generateEmailVerificationCode(
|
||||
userId: string,
|
||||
email: string,
|
||||
email: string
|
||||
): Promise<string> {
|
||||
await db
|
||||
.delete(emailVerificationCodes)
|
||||
|
@ -41,7 +41,7 @@ async function generateEmailVerificationCode(
|
|||
userId,
|
||||
email,
|
||||
code,
|
||||
expiresAt: createDate(new TimeSpan(15, "m")).getTime(),
|
||||
expiresAt: createDate(new TimeSpan(15, "m")).getTime()
|
||||
});
|
||||
|
||||
return code;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue