From f4d5348a60dc4e96448e2002a7efecacdff9d7d0 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Mon, 23 Oct 2023 19:36:44 +0300 Subject: [PATCH] Revert "fix reset password" This reverts commit 4949526d3fe712dc50985bcd17b14cc527457584. --- src/pages/forgot-password.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/forgot-password.tsx b/src/pages/forgot-password.tsx index 0f752d1a02d..7ddaee73020 100644 --- a/src/pages/forgot-password.tsx +++ b/src/pages/forgot-password.tsx @@ -1,11 +1,11 @@ import React from "react"; import Head from "next/head"; import Link from "next/link"; +import { useRouter } from "next/router"; import { Button, Group, Paper, Stack, TextInput, Text, Anchor, PasswordInput } from "@mantine/core"; import { toast } from "react-hot-toast"; import Layout from "src/layout/Layout"; import { supabase } from "src/lib/api/supabase"; -import useUser from "src/store/useUser"; function ResetPassword() { const [loading, setLoading] = React.useState(false); @@ -68,10 +68,11 @@ function ResetPassword() { } const ForgotPassword = () => { - const isAuthenticated = useUser(state => state.isAuthenticated); + const { query } = useRouter(); const [loading, setLoading] = React.useState(false); const [email, setEmail] = React.useState(""); const [success, setSuccess] = React.useState(false); + const isPasswordReset = query?.type === "recovery" && !query?.error; const onSubmit = async (e: React.FormEvent) => { try { @@ -96,7 +97,7 @@ const ForgotPassword = () => { Reset Password - JSON Crack - {isAuthenticated ? ( + {isPasswordReset ? ( ) : (