cleanup verify

This commit is contained in:
peintnermax
2024-09-12 16:28:15 +02:00
parent 3d99a686fa
commit c955914278
2 changed files with 3 additions and 45 deletions

View File

@@ -1,8 +1,6 @@
import { loadMostRecentSession } from "@/lib/session";
import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel"; import { getBrandingSettings, getLoginSettings } from "@/lib/zitadel";
import Alert from "@/ui/Alert"; import Alert from "@/ui/Alert";
import DynamicTheme from "@/ui/DynamicTheme"; import DynamicTheme from "@/ui/DynamicTheme";
import UserAvatar from "@/ui/UserAvatar";
import VerifyEmailForm from "@/ui/VerifyEmailForm"; import VerifyEmailForm from "@/ui/VerifyEmailForm";
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
@@ -17,11 +15,6 @@ export default async function Page({ searchParams }: { searchParams: any }) {
authRequestId, authRequestId,
} = searchParams; } = searchParams;
const sessionFactors = await loadMostRecentSession({
loginName,
organization,
});
const branding = await getBrandingSettings(organization); const branding = await getBrandingSettings(organization);
const loginSettings = await getLoginSettings(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. Enter the Code provided in the verification email.
</p> </p>
{(!sessionFactors || !loginName) && ( {!userId && (
<div className="py-4"> <div className="py-4">
<Alert> <Alert>
Could not get the context of the user. Make sure to enter the Could not get the context of the user. Make sure to provide a
username first or provide a loginName as searchParam. userId as searchParam.
</Alert> </Alert>
</div> </div>
)} )}
{sessionFactors && (
<UserAvatar
loginName={loginName ?? sessionFactors.factors?.user?.loginName}
displayName={sessionFactors.factors?.user?.displayName}
showDropdown
searchParams={searchParams}
></UserAvatar>
)}
{userId ? ( {userId ? (
<VerifyEmailForm <VerifyEmailForm
userId={userId} userId={userId}
@@ -62,12 +46,6 @@ export default async function Page({ searchParams }: { searchParams: any }) {
authRequestId={authRequestId} authRequestId={authRequestId}
sessionId={sessionId} sessionId={sessionId}
loginSettings={loginSettings} 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"> <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">

View File

@@ -23,7 +23,6 @@ type Props = {
authRequestId?: string; authRequestId?: string;
sessionId?: string; sessionId?: string;
loginSettings?: LoginSettings; loginSettings?: LoginSettings;
hasMfaSetUp: boolean;
}; };
export default function VerifyEmailForm({ export default function VerifyEmailForm({
@@ -35,7 +34,6 @@ export default function VerifyEmailForm({
authRequestId, authRequestId,
sessionId, sessionId,
loginSettings, loginSettings,
hasMfaSetUp,
}: Props) { }: Props) {
const { register, handleSubmit, formState } = useForm<Inputs>({ const { register, handleSubmit, formState } = useForm<Inputs>({
mode: "onBlur", mode: "onBlur",
@@ -88,24 +86,6 @@ export default function VerifyEmailForm({
return; 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({}); const params = new URLSearchParams({});
if (organization) { if (organization) {