diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 697d1fe7..faecef4f 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -20,7 +20,7 @@ export default function Login() { push('/'); }; - const signInWithEmail = async () => { + const handleSignIn = async () => { const { error } = await supabase.auth.signInWithPassword({ email, password, @@ -48,7 +48,7 @@ export default function Login() { - diff --git a/src/app/reset-password/page.tsx b/src/app/reset-password/page.tsx index 5451624c..7a58eee4 100644 --- a/src/app/reset-password/page.tsx +++ b/src/app/reset-password/page.tsx @@ -5,10 +5,13 @@ import { useRouter } from 'next/navigation'; import supabase from '../../api/supabase/createClient'; export default function ResetPassword() { - const [newPassword, setPassword] = useState(''); + const [password, setPassword] = useState(''); const { push } = useRouter(); const resetPassword = async () => { - await supabase.auth.updateUser({ password: newPassword }); + const { error } = await supabase.auth.updateUser({ password }); + if (error) { + throw new Error(`An error occurred trying to sign in: ${error}`); + } push('/login'); }; @@ -18,7 +21,7 @@ export default function ResetPassword() { type="password" name="password" onChange={e => setPassword(e.target.value)} - value={newPassword} + value={password} />