22import { useState , useEffect } from "react" ;
33import { useRouter } from "next/navigation" ;
44import { useAuth } from "@/hooks/use-auth" ;
5+ import { useRecaptcha } from "@/hooks/use-recaptcha" ;
56import { useToast } from "@/hooks/use-toast" ;
67import { FormInput } from "@/components/registration/form-input" ;
78import { Button } from "@/components/registration/button" ;
89import { Card } from "@/components/registration/card" ;
910import { StickyAlert } from "@/components/registration/sticky-alert" ;
11+ import { RecaptchaNotice } from "@/components/registration/recaptcha-notice" ;
1012import { DotPattern } from "@/components/registration/dot-pattern" ;
1113import { Spinner } from "@/components/ui/spinner" ;
1214import { UserPlus , LogIn } from "lucide-react" ;
1315import Link from "next/link" ;
1416
1517export default function AdminRegisterPage ( ) {
1618 const { isAuthenticated, isLoading } = useAuth ( ) ;
19+ const { executeRecaptcha } = useRecaptcha ( ) ;
1720 const { toast } = useToast ( ) ;
1821 const router = useRouter ( ) ;
1922
@@ -157,6 +160,7 @@ export default function AdminRegisterPage() {
157160 setAlert ( null ) ;
158161
159162 try {
163+ const recaptchaToken = await executeRecaptcha ( "admin_register" ) ;
160164 const response = await fetch ( '/api/admin/register' , {
161165 method : 'POST' ,
162166 headers : {
@@ -167,6 +171,7 @@ export default function AdminRegisterPage() {
167171 email : formData . email . trim ( ) ,
168172 password : formData . password ,
169173 adminCode : formData . adminCode . trim ( ) ,
174+ recaptcha_token : recaptchaToken ,
170175 } ) ,
171176 } ) ;
172177
@@ -451,6 +456,7 @@ export default function AdminRegisterPage() {
451456 < LogIn className = "w-[16px] h-[16px]" />
452457 < span > Login</ span >
453458 </ Link >
459+ < RecaptchaNotice className = "mt-[16px]" />
454460 </ div >
455461 </ Card >
456462 </ div >
0 commit comments