mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 15:07:32 +00:00
check email sending
This commit is contained in:
@@ -90,7 +90,7 @@ describe("verify email", () => {
|
||||
});
|
||||
// TODO: Avoid uncaught exception in application
|
||||
cy.once("uncaught:exception", () => false);
|
||||
cy.visit("/verify?userId=221394658884845598&code=abc&send=true");
|
||||
cy.visit("/verify?userId=221394658884845598&code=abc");
|
||||
cy.contains("Could not verify email", { timeout: 10_000 });
|
||||
});
|
||||
});
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"description": "Geben Sie den Code ein, der in der Bestätigungs-E-Mail angegeben ist.",
|
||||
"noCodeReceived": "Keinen Code erhalten?",
|
||||
"resendCode": "Code erneut senden",
|
||||
"codeSent": "Ein Code wurde gerade an Ihre E-Mail-Adresse gesendet.",
|
||||
"submit": "Weiter"
|
||||
}
|
||||
},
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"description": "Enter the Code provided in the verification email.",
|
||||
"noCodeReceived": "Didn't receive a code?",
|
||||
"resendCode": "Resend code",
|
||||
"codeSent": "A code has just been sent to your email address.",
|
||||
"submit": "Continue"
|
||||
}
|
||||
},
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"description": "Introduce el código proporcionado en el correo electrónico de verificación.",
|
||||
"noCodeReceived": "¿No recibiste un código?",
|
||||
"resendCode": "Reenviar código",
|
||||
"codeSent": "Se ha enviado un código a tu dirección de correo electrónico.",
|
||||
"submit": "Continuar"
|
||||
}
|
||||
},
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"description": "Inserisci il codice fornito nell'email di verifica.",
|
||||
"noCodeReceived": "Non hai ricevuto un codice?",
|
||||
"resendCode": "Invia di nuovo il codice",
|
||||
"codeSent": "Un codice è stato appena inviato al tuo indirizzo email.",
|
||||
"submit": "Continua"
|
||||
}
|
||||
},
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"description": "Wprowadź kod z wiadomości weryfikacyjnej.",
|
||||
"noCodeReceived": "Nie otrzymałeś kodu?",
|
||||
"resendCode": "Wyślij kod ponownie",
|
||||
"codeSent": "Kod został właśnie wysłany na twój adres e-mail.",
|
||||
"submit": "Kontynuuj"
|
||||
}
|
||||
},
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"description": "Введите код из письма подтверждения.",
|
||||
"noCodeReceived": "Не получили код?",
|
||||
"resendCode": "Отправить код повторно",
|
||||
"codeSent": "Код отправлен на ваш email.",
|
||||
"submit": "Продолжить"
|
||||
}
|
||||
},
|
||||
|
@@ -181,6 +181,7 @@
|
||||
"description": "输入验证邮件中的验证码。",
|
||||
"noCodeReceived": "没有收到验证码?",
|
||||
"resendCode": "重发验证码",
|
||||
"codeSent": "刚刚发送了一封包含验证码的电子邮件。",
|
||||
"submit": "继续"
|
||||
}
|
||||
},
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Alert } from "@/components/alert";
|
||||
import { Alert, AlertType } from "@/components/alert";
|
||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||
import { UserAvatar } from "@/components/user-avatar";
|
||||
import { VerifyForm } from "@/components/verify-form";
|
||||
@@ -148,6 +148,12 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
||||
</>
|
||||
)}
|
||||
|
||||
{id && send && (
|
||||
<div className="py-4 w-full">
|
||||
<Alert type={AlertType.INFO}>{tError("verify.codesent")}</Alert>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{sessionFactors ? (
|
||||
<UserAvatar
|
||||
loginName={loginName ?? sessionFactors.factors?.user?.loginName}
|
||||
|
@@ -268,13 +268,14 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
||||
return inviteCheck;
|
||||
}
|
||||
|
||||
// check if user was verified
|
||||
// check if user was verified recently
|
||||
const isUserVerified = await checkUserVerification(
|
||||
session.factors.user.id,
|
||||
);
|
||||
if (!isUserVerified) {
|
||||
const params = new URLSearchParams({
|
||||
loginName: session.factors?.user?.loginName as string,
|
||||
// send: "true", // set this to true to request a new code immediately
|
||||
});
|
||||
|
||||
if (command.requestId) {
|
||||
|
@@ -274,7 +274,6 @@ export async function resendVerification(command: resendVerifyEmailCommand) {
|
||||
|
||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||
|
||||
const doSend = true;
|
||||
// create a new invite whenever the resend is called
|
||||
return command.isInvite
|
||||
? createInviteCode({
|
||||
@@ -282,22 +281,19 @@ export async function resendVerification(command: resendVerifyEmailCommand) {
|
||||
userId: command.userId,
|
||||
urlTemplate:
|
||||
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
|
||||
(command.requestId ? `&requestId=${command.requestId}` : "") +
|
||||
(doSend ? `&send=${doSend}` : ""),
|
||||
(command.requestId ? `&requestId=${command.requestId}` : ""),
|
||||
}) //resendInviteCode({ serviceUrl, userId: command.userId })
|
||||
: resendEmailCode({
|
||||
userId: command.userId,
|
||||
serviceUrl,
|
||||
urlTemplate:
|
||||
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}` +
|
||||
(command.requestId ? `&requestId=${command.requestId}` : "") +
|
||||
(doSend ? `&send=${doSend}` : ""),
|
||||
(command.requestId ? `&requestId=${command.requestId}` : ""),
|
||||
});
|
||||
}
|
||||
|
||||
type sendEmailCommand = {
|
||||
serviceUrl: string;
|
||||
|
||||
userId: string;
|
||||
urlTemplate: string;
|
||||
};
|
||||
|
Reference in New Issue
Block a user