added email verification
This commit is contained in:
36
apps/hub/app/_components/EmailVerification.tsx
Normal file
36
apps/hub/app/_components/EmailVerification.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
import { useSession } from "next-auth/react";
|
||||
import toast from "react-hot-toast";
|
||||
import { sendVerificationLink } from "(app)/admin/user/action";
|
||||
import { TriangleAlert } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "_components/ui/Button";
|
||||
|
||||
export const EmailVerification = () => {
|
||||
const session = useSession();
|
||||
const [loading, setLoading] = useState(false);
|
||||
return (
|
||||
<div role="alert" className="alert alert-warning">
|
||||
<TriangleAlert />
|
||||
<div>
|
||||
<h3 className="font-bold">Email Addresse nicht bestätigt!</h3>
|
||||
<div className="text-xs">
|
||||
Wenn deine Email Addresse nicht bestätigt ist kannst du dich nicht Verbinden
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
isLoading={loading}
|
||||
className="btn btn-sm"
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
if (!session.data?.user?.id) return;
|
||||
await sendVerificationLink(session.data.user.id); // Replace "userId" with the actual user ID
|
||||
toast.success("Verifizierungslink gesendet! Bitte prüfe deine E-Mails.");
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
Link senden
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user