Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/pages/ResetPasswordPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useEffect, type FormEvent } from "react";
import { useNavigate } from "react-router-dom";
import { supabase } from "../supabase-client";
import { supabase, isBackendAvailable } from "../supabase-client";
import { Lock } from "lucide-react";
import { showSuccess, showError } from "../utils/toast";

Expand All @@ -13,6 +13,10 @@ export default function ResetPasswordPage() {
const navigate = useNavigate();

useEffect(() => {
if (!isBackendAvailable || !supabase) {
showError("Password reset is unavailable in demo mode or without backend configuration.");
return;
}
// Check if we have a valid session from the reset link
supabase.auth.getSession().then(({ data: { session } }) => {
if (!session) {
Expand All @@ -36,6 +40,11 @@ export default function ResetPasswordPage() {
return;
}

if (!isBackendAvailable || !supabase) {
setError("Password reset is unavailable in demo mode or without backend configuration.");
return;
}

setLoading(true);

try {
Expand Down