fix(portal): redirect unauthenticated users to login — never show portal chrome (GRO-309)

- CustomerPortal.tsx: add initComplete state to track async session
  initialization. After init completes with no valid session, redirect:
  staff dev users → /admin, all others → /login
- Dashboard.tsx: change !sessionId fallback from dead-end UI to
  <Navigate to="/login" replace /> (defense-in-depth)
- All 85 web unit tests pass

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Barkley Trimsworth
2026-03-31 00:53:59 +00:00
parent 026a2c8b0e
commit 5860d822cf
2 changed files with 21 additions and 10 deletions
+2 -7
View File
@@ -1,4 +1,5 @@
import { useState, useEffect } from "react";
import { Navigate } from "react-router-dom";
import { Calendar, Clock, PawPrint, CreditCard, Star, ChevronRight, AlertTriangle } from "lucide-react";
interface DashboardProps {
@@ -183,13 +184,7 @@ export function Dashboard({
}
if (!sessionId) {
return (
<div className="space-y-6">
<div className="bg-stone-100 rounded-2xl p-5 text-center">
<p className="text-stone-600">Please sign in to view your dashboard.</p>
</div>
</div>
);
return <Navigate to="/login" replace />;
}
const upcomingAppointments = getUpcomingAppointments();