Files
adminandClaude Sonnet 4.6 d18d29168a feat(auth): phase 3 — replace Supabase GoTrue with bcryptjs+jose
Custom auth stack: bcryptjs password hashing (cost 10, GoTrue-compatible),
jose JWT session cookies (edge-safe, 8hr TTL), new API routes for
login/logout/reset/change-password, middleware rewritten to JWT-only
verification with no DB access. All 38 protected pages and API routes
migrated from supabase.auth.getUser() to getSession(). Supabase .from()
queries retained for Phase 4. lib/db/index.ts refactored to lazy Proxy
singleton to avoid module-level throw during Next.js build.

tsc: clean, build: clean, tests: 4/4 passed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-23 16:20:04 +08:00

30 lines
1.3 KiB
TypeScript

export const dynamic = 'force-dynamic'
import Link from 'next/link'
import { redirect } from 'next/navigation'
import { getSession } from '@/lib/auth/get-session'
export default async function HsePage() {
const session = await getSession()
if (!session) redirect('/login')
return (
<main className="max-w-4xl mx-auto px-4 py-6">
<h1 className="text-2xl font-bold text-gray-900 mb-1">HSE Officer Portal</h1>
<p className="text-gray-500 text-sm mb-8">Welcome, {session.name}</p>
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3">
<Link href="/hse/incidents" className="bg-white rounded-xl shadow-sm p-5 hover:shadow-md transition-shadow border border-gray-100">
<div className="text-2xl mb-2">📋</div>
<div className="font-semibold text-gray-900">Incident Inbox</div>
<div className="text-xs text-gray-500 mt-1">View all incidents</div>
</Link>
<Link href="/hse/dashboard" className="bg-white rounded-xl shadow-sm p-5 hover:shadow-md transition-shadow border border-gray-100">
<div className="text-2xl mb-2">📊</div>
<div className="font-semibold text-gray-900">Dashboard</div>
<div className="text-xs text-gray-500 mt-1">Stats & overview</div>
</Link>
</div>
</main>
)
}