fix user verification check

This commit is contained in:
Max Peintner
2025-05-21 11:42:52 +02:00
parent f6d546a8ea
commit f1cb621333
3 changed files with 5 additions and 6 deletions

View File

@@ -275,7 +275,7 @@ export async function sendLoginname(command: SendLoginnameCommand) {
if (!isUserVerified) { if (!isUserVerified) {
const params = new URLSearchParams({ const params = new URLSearchParams({
loginName: session.factors?.user?.loginName as string, loginName: session.factors?.user?.loginName as string,
// send: "true", // set this to true to request a new code immediately send: "true", // set this to true to request a new code immediately
}); });
if (command.requestId) { if (command.requestId) {

View File

@@ -6,7 +6,6 @@ import {
getSession, getSession,
getUserByID, getUserByID,
listAuthenticationMethodTypes, listAuthenticationMethodTypes,
resendEmailCode,
verifyEmail, verifyEmail,
verifyInviteCode, verifyInviteCode,
verifyTOTPRegistration, verifyTOTPRegistration,
@@ -283,7 +282,7 @@ export async function resendVerification(command: resendVerifyEmailCommand) {
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` + `${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
(command.requestId ? `&requestId=${command.requestId}` : ""), (command.requestId ? `&requestId=${command.requestId}` : ""),
}) //resendInviteCode({ serviceUrl, userId: command.userId }) }) //resendInviteCode({ serviceUrl, userId: command.userId })
: resendEmailCode({ : sendEmailCode({
userId: command.userId, userId: command.userId,
serviceUrl, serviceUrl,
urlTemplate: urlTemplate:

View File

@@ -258,15 +258,15 @@ export async function checkUserVerification(userId: string): Promise<boolean> {
const cookiesList = await cookies(); const cookiesList = await cookies();
// only read cookie to prevent issues on page.tsx // only read cookie to prevent issues on page.tsx
const userAgentId = await getFingerprintIdCookie(); const fingerPrintCookie = await getFingerprintIdCookie();
if (!userAgentId || userAgentId.value) { if (!fingerPrintCookie || !fingerPrintCookie.value) {
return false; return false;
} }
const verificationCheck = crypto const verificationCheck = crypto
.createHash("sha256") .createHash("sha256")
.update(`${userId}:${userAgentId}`) .update(`${userId}:${fingerPrintCookie.value}`)
.digest("hex"); .digest("hex");
const cookieValue = await cookiesList.get("verificationCheck")?.value; const cookieValue = await cookiesList.get("verificationCheck")?.value;