diff --git a/src/app/verify/page.tsx b/src/app/verify/page.tsx
new file mode 100644
index 0000000..7628437
--- /dev/null
+++ b/src/app/verify/page.tsx
@@ -0,0 +1,43 @@
+"use client";
+
+import { useRouter } from "next/navigation";
+import { useEffect } from "react";
+import { Button } from "@/components/ui/button";
+import { useSearchParams } from "next/navigation";
+import { Mail } from "lucide-react";
+import Link from "next/link";
+
+const VerifyPage = () => {
+ const router = useRouter();
+ const searchParams = useSearchParams();
+ const email = searchParams.get("email");
+
+ useEffect(() => {
+ if (!email) {
+ router.push("/");
+ }
+ }, [email, router]);
+
+ return (
+
+
+
+
+
+
Check Your Email
+
+ We have sent a verification link to {email}. Please check your inbox (and spam folder) to
+ confirm your email address.
+
+
+ If you did not receive the email, click below to contact support.
+
+
+
+
+
+
+ );
+};
+
+export default VerifyPage;
diff --git a/src/components/auth/action.ts b/src/components/auth/action.ts
index a4c2ff0..cc2ac2d 100644
--- a/src/components/auth/action.ts
+++ b/src/components/auth/action.ts
@@ -33,6 +33,7 @@ export async function signup(formData: FormData) {
password: formData.get("password") as string,
options: {
captchaToken: formData.get("captchaToken") as string,
+ emailRedirectTo: "http://localhost:3000/auth",
},
};
diff --git a/src/components/auth/signupForm.tsx b/src/components/auth/signupForm.tsx
index afcd9cd..82d913b 100644
--- a/src/components/auth/signupForm.tsx
+++ b/src/components/auth/signupForm.tsx
@@ -16,6 +16,7 @@ export function SignupForm() {
const [error, setError] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const [captchaToken, setCaptchaToken] = useState(undefined);
+ const [isSendingForm, setIsSendingForm] = useState(false);
const captcha = useRef(null);
const handleSignup = async (event: React.FormEvent) => {
@@ -42,13 +43,16 @@ export function SignupForm() {
}
try {
+ setIsSendingForm(true);
await signup(formData);
captcha.current?.resetCaptcha();
toast.success("Account created successfully!");
- router.push("/");
+ router.push(`/verify?email=${formData.get("email") as string}`);
} catch (error: any) {
captcha.current?.resetCaptcha();
setError(error.message);
+ } finally {
+ setIsSendingForm(false);
}
};
@@ -86,8 +90,8 @@ export function SignupForm() {
}}
/>
{error && {error}
}
-