Skip to content

Commit

Permalink
password reset
Browse files Browse the repository at this point in the history
  • Loading branch information
craigkai committed Sep 30, 2024
1 parent ab0ce67 commit 621792a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/routes/auth/recovery/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
let newPassword: string = '';
async function resetPassword() {
await data.supabase.auth
.updateUser({ password: newPassword })
.then((_) => {
toast.success('Password updated successfully');
goto('/protected-routes/dashboard');
})
.catch((err) => {
toast.error(err.message);
try {
const { data: userData, error } = await data.supabase.auth.updateUser({
password: newPassword
});
if (error) {
throw error;
}
toast.success('Password updated successfully');
goto('/protected-routes/dashboard');
} catch (err) {
toast.error(err.message || 'Failed to update password');
}
}
const whoAmI = data?.user?.email;
</script>
Expand Down

0 comments on commit 621792a

Please sign in to comment.