diff --git a/apps/web/app/(auth)/auth/forgot-password/reset/components/ResetPasswordForm/index.tsx b/apps/web/app/(auth)/auth/forgot-password/reset/components/ResetPasswordForm/index.tsx index 11cbaba1d3..5f6224642e 100644 --- a/apps/web/app/(auth)/auth/forgot-password/reset/components/ResetPasswordForm/index.tsx +++ b/apps/web/app/(auth)/auth/forgot-password/reset/components/ResetPasswordForm/index.tsx @@ -5,6 +5,7 @@ import { resetPassword } from "@/app/lib/users/users"; import { XCircleIcon } from "@heroicons/react/24/solid"; import { useRouter, useSearchParams } from "next/navigation"; import { useState } from "react"; +import { toast } from "react-hot-toast"; import { Button } from "@formbricks/ui/Button"; import { PasswordInput } from "@formbricks/ui/PasswordInput"; @@ -14,11 +15,16 @@ export const ResetPasswordForm = () => { const router = useRouter(); const [error, setError] = useState(""); const [password, setPassword] = useState(null); + const [confirmPassword, setConfirmPassword] = useState(null); const [isValid, setIsValid] = useState(false); const [loading, setLoading] = useState(false); const handleSubmit = async (e) => { e.preventDefault(); + if (password !== confirmPassword) { + toast.error("Passwords do not match"); + return; + } setLoading(true); const token = searchParams?.get("token"); try { @@ -51,23 +57,39 @@ export const ResetPasswordForm = () => { )}
-
- -
+
+
+ setPassword(e.target.value)} autoComplete="current-password" placeholder="*******" required - className="focus:border-brand focus:ring-brand block w-full rounded-md border-slate-300 shadow-sm sm:text-sm" + className="focus:border-brand focus:ring-brand mt-2 block w-full rounded-md border-slate-300 shadow-sm sm:text-sm" /> -
+
+ + setConfirmPassword(e.target.value)} + autoComplete="current-password" + placeholder="*******" + required + className="focus:border-brand focus:ring-brand mt-2 block w-full rounded-md border-slate-300 shadow-sm sm:text-sm" + /> +
+ +
diff --git a/apps/web/app/(auth)/auth/layout.tsx b/apps/web/app/(auth)/auth/layout.tsx index ff3f4cf3cd..9825cda433 100644 --- a/apps/web/app/(auth)/auth/layout.tsx +++ b/apps/web/app/(auth)/auth/layout.tsx @@ -1,5 +1,6 @@ import { getServerSession } from "next-auth"; import { redirect } from "next/navigation"; +import { Toaster } from "react-hot-toast"; import { authOptions } from "@formbricks/lib/authOptions"; @@ -9,10 +10,13 @@ export default async function AuthLayout({ children }: { children: React.ReactNo redirect(`/`); } return ( -
-
-
{children}
+ <> + +
+
+
{children}
+
-
+ ); }