mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 13:05:25 +02:00
feat(auth): add email/password login restricted to @craze.de accounts
- src/lib/auth.ts: signIn/signOut/getStoredSession via Supabase Auth REST API - src/components/LoginPage.tsx: login form with domain validation UI - src/components/TopBar.tsx: show logged-in user email + sign out button - src/App.tsx: gate entire app behind auth — shows LoginPage if no session Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
9b10b628af
commit
eeb6711b69
+19
-4
@@ -8,8 +8,21 @@ import { MatrixView } from './components/MatrixView';
|
||||
import { UploadReload } from './components/UploadReload';
|
||||
import { EditPanel } from './components/EditPanel';
|
||||
import { getAllSyncedRows, saveRowToSupabase } from './lib/supabase';
|
||||
import { getStoredSession, signOut, type AuthSession } from './lib/auth';
|
||||
import { LoginPage } from './components/LoginPage';
|
||||
|
||||
export default function App() {
|
||||
const [session, setSession] = useState<AuthSession | null>(() => getStoredSession());
|
||||
|
||||
const handleSignOut = () => {
|
||||
signOut();
|
||||
setSession(null);
|
||||
};
|
||||
|
||||
if (!session) {
|
||||
return <LoginPage onLogin={() => setSession(getStoredSession())} />;
|
||||
}
|
||||
|
||||
const [appState, setAppState] = useState<AppState>({
|
||||
headers: [],
|
||||
data: [],
|
||||
@@ -192,11 +205,13 @@ export default function App() {
|
||||
|
||||
return (
|
||||
<div className="h-screen bg-slate-900 text-slate-200 flex flex-col font-sans overflow-hidden">
|
||||
<TopBar
|
||||
stats={stats}
|
||||
onExport={handleExport}
|
||||
hasData={appState.data.length > 0}
|
||||
<TopBar
|
||||
stats={stats}
|
||||
onExport={handleExport}
|
||||
hasData={appState.data.length > 0}
|
||||
hasUnsavedChanges={appState.hasUnsavedChanges}
|
||||
userEmail={session.user.email}
|
||||
onSignOut={handleSignOut}
|
||||
/>
|
||||
<div className="flex flex-1 overflow-hidden">
|
||||
<Sidebar activeModule={activeModule} setActiveModule={setActiveModule} />
|
||||
|
||||
Reference in New Issue
Block a user