mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 22:13:56 +00:00
verify email
This commit is contained in:
@@ -2,7 +2,6 @@ import { listSessions, server } from "#/lib/zitadel";
|
||||
import { Avatar, AvatarSize } from "#/ui/Avatar";
|
||||
import { getAllSessionIds } from "#/utils/cookies";
|
||||
import {
|
||||
ChevronRightIcon,
|
||||
ExclamationTriangleIcon,
|
||||
XCircleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
|
||||
@@ -11,6 +11,8 @@ export default async function Page() {
|
||||
server
|
||||
);
|
||||
|
||||
console.log(legal);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center space-y-4">
|
||||
<h1>Register</h1>
|
||||
@@ -18,7 +20,7 @@ export default async function Page() {
|
||||
|
||||
{legal && passwordComplexitySettings && (
|
||||
<RegisterForm
|
||||
privacyPolicy={legal}
|
||||
legal={legal}
|
||||
passwordComplexityPolicy={passwordComplexitySettings}
|
||||
></RegisterForm>
|
||||
)}
|
||||
|
||||
24
apps/login/app/(login)/verify/page.tsx
Normal file
24
apps/login/app/(login)/verify/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import VerifyEmailForm from "#/ui/VerifyEmailForm";
|
||||
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
export default async function Page({ searchParams }: { searchParams: any }) {
|
||||
const { userID, code, orgID, loginname, passwordset } = searchParams;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center space-y-4">
|
||||
<h1>Verify user</h1>
|
||||
<p className="ztdl-p mb-6 block">
|
||||
Enter the Code provided in the verification email.
|
||||
</p>
|
||||
|
||||
{userID ? (
|
||||
<VerifyEmailForm userId={userID} />
|
||||
) : (
|
||||
<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">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 mr-2" />
|
||||
<span className="text-center text-sm">No userId provided!</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
15
apps/login/app/email/verify/route.ts
Normal file
15
apps/login/app/email/verify/route.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { server, verifyEmail } from "#/lib/zitadel";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
if (body) {
|
||||
const { userId, code } = body;
|
||||
|
||||
return verifyEmail(server, userId, code).then((resp) => {
|
||||
return NextResponse.json(resp);
|
||||
});
|
||||
} else {
|
||||
return NextResponse.error();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user