Skip to content

Commit

Permalink
resolved password not resetting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourabh782 committed Oct 15, 2024
1 parent c9c6882 commit 3ce4661
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/auth/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import { useState } from "react";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import styles from "./page.module.css";
Expand All @@ -19,10 +19,15 @@ export default function Auth() {
register,
handleSubmit,
formState: { errors },
reset,
} = useForm({
resolver: zodResolver(isSignup ? signupSchema : loginSchema),
});

useEffect(() => {
reset();
}, [isSignup, reset]);

console.log(callback);

const onSubmit = async (data: any) => {
Expand Down
3 changes: 2 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export default async function RootLayout({
const pathname = h.get("x-current-path");

if (session) {
if (!session.user.emailVerified) {
console.log(session)
if (!session.user?.emailVerified) {
if (!pathname!.includes("/auth")) {
redirect("/auth/verify");
}
Expand Down

0 comments on commit 3ce4661

Please sign in to comment.