mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 20:37:31 +00:00
fix user verification check
This commit is contained in:
@@ -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) {
|
||||||
|
@@ -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:
|
||||||
|
@@ -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;
|
||||||
|
Reference in New Issue
Block a user