mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 06:42:59 +00:00
cleanup verify
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { loadMostRecentSession } from "@/lib/session";
|
||||
import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel";
|
||||
import Alert from "@/ui/Alert";
|
||||
import DynamicTheme from "@/ui/DynamicTheme";
|
||||
import UserAvatar from "@/ui/UserAvatar";
|
||||
import VerifyEmailForm from "@/ui/VerifyEmailForm";
|
||||
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
@@ -17,11 +15,6 @@ export default async function Page({ searchParams }: { searchParams: any }) {
|
||||
authRequestId,
|
||||
} = searchParams;
|
||||
|
||||
const sessionFactors = await loadMostRecentSession({
|
||||
loginName,
|
||||
organization,
|
||||
});
|
||||
|
||||
const branding = await getBrandingSettings(organization);
|
||||
|
||||
const loginSettings = await getLoginSettings(organization);
|
||||
@@ -34,24 +27,15 @@ export default async function Page({ searchParams }: { searchParams: any }) {
|
||||
Enter the Code provided in the verification email.
|
||||
</p>
|
||||
|
||||
{(!sessionFactors || !loginName) && (
|
||||
{!userId && (
|
||||
<div className="py-4">
|
||||
<Alert>
|
||||
Could not get the context of the user. Make sure to enter the
|
||||
username first or provide a loginName as searchParam.
|
||||
Could not get the context of the user. Make sure to provide a
|
||||
userId as searchParam.
|
||||
</Alert>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{sessionFactors && (
|
||||
<UserAvatar
|
||||
loginName={loginName ?? sessionFactors.factors?.user?.loginName}
|
||||
displayName={sessionFactors.factors?.user?.displayName}
|
||||
showDropdown
|
||||
searchParams={searchParams}
|
||||
></UserAvatar>
|
||||
)}
|
||||
|
||||
{userId ? (
|
||||
<VerifyEmailForm
|
||||
userId={userId}
|
||||
@@ -62,12 +46,6 @@ export default async function Page({ searchParams }: { searchParams: any }) {
|
||||
authRequestId={authRequestId}
|
||||
sessionId={sessionId}
|
||||
loginSettings={loginSettings}
|
||||
hasMfaSetUp={
|
||||
!!sessionFactors?.factors?.otpEmail?.verifiedAt ||
|
||||
!!sessionFactors?.factors?.otpSms?.verifiedAt ||
|
||||
!!sessionFactors?.factors?.totp?.verifiedAt ||
|
||||
!!sessionFactors?.factors?.webAuthN?.verifiedAt
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="w-full flex flex-row items-center justify-center border border-yellow-600/40 dark:border-yellow-500/20 bg-yellow-200/30 text-yellow-600 dark:bg-yellow-700/20 dark:text-yellow-200 rounded-md py-2 scroll-px-40">
|
||||
|
||||
@@ -23,7 +23,6 @@ type Props = {
|
||||
authRequestId?: string;
|
||||
sessionId?: string;
|
||||
loginSettings?: LoginSettings;
|
||||
hasMfaSetUp: boolean;
|
||||
};
|
||||
|
||||
export default function VerifyEmailForm({
|
||||
@@ -35,7 +34,6 @@ export default function VerifyEmailForm({
|
||||
authRequestId,
|
||||
sessionId,
|
||||
loginSettings,
|
||||
hasMfaSetUp,
|
||||
}: Props) {
|
||||
const { register, handleSubmit, formState } = useForm<Inputs>({
|
||||
mode: "onBlur",
|
||||
@@ -88,24 +86,6 @@ export default function VerifyEmailForm({
|
||||
return;
|
||||
}
|
||||
|
||||
if (loginSettings && loginSettings.forceMfa && !hasMfaSetUp) {
|
||||
const params = new URLSearchParams({ checkAfter: "true" });
|
||||
|
||||
if (loginName) {
|
||||
params.set("organization", loginName);
|
||||
}
|
||||
if (organization) {
|
||||
params.set("organization", organization);
|
||||
}
|
||||
|
||||
if (authRequestId && sessionId) {
|
||||
params.set("authRequest", authRequestId);
|
||||
params.set("sessionId", sessionId);
|
||||
}
|
||||
|
||||
return router.push(`/mfa/set?` + params);
|
||||
}
|
||||
|
||||
const params = new URLSearchParams({});
|
||||
|
||||
if (organization) {
|
||||
|
||||
Reference in New Issue
Block a user