end cleanup
This commit is contained in:
+19
-33
@@ -2,42 +2,32 @@ import { useLoginFlow } from '@/hooks/useLoginFlow';
|
||||
import { LocalLoginForm } from '@/components/auth/LocalLoginForm';
|
||||
import { MfaForm } from '@/components/auth/MfaForm';
|
||||
import { Card, CardContent } from '@/components/ui/Card';
|
||||
import LogoGise from '@/components/ui/LogoGise';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { GlobeLock } from 'lucide-react';
|
||||
import Badge from '@/components/ui/Badge';
|
||||
|
||||
interface LoginProps {
|
||||
onLoginSuccess: () => void;
|
||||
}
|
||||
|
||||
export default function Login({ onLoginSuccess }: LoginProps) {
|
||||
const {
|
||||
step, isLoading, error, mfaConfig,
|
||||
loginWithZitadel, loginWithLocal, verifyMfa, cancelMfa
|
||||
const {
|
||||
step, isLoading, error, mfaConfig,
|
||||
loginWithZitadel, loginWithLocal, verifyMfa, cancelMfa
|
||||
} = useLoginFlow(onLoginSuccess);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8 font-sans selection:bg-blue-900 selection:text-white">
|
||||
|
||||
<div className="min-h-screen bg-[#e8e8e8] dark:bg-[#1e293b] flex flex-col justify-center py-12 sm:px-6 lg:px-8 font-sans selection:bg-blue-900 selection:text-white">
|
||||
|
||||
{/* HEADER LOGO */}
|
||||
<div className="sm:mx-auto sm:w-full sm:max-w-md">
|
||||
<div className="flex justify-center">
|
||||
<div className="h-12 w-12 bg-blue-900 rounded-lg flex items-center justify-center shadow-sm border border-blue-800">
|
||||
<svg className="w-8 h-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<h2 className="mt-6 text-center text-3xl font-bold tracking-tight text-slate-900">
|
||||
AEGIS <span className="font-light text-slate-500">by GISE</span>
|
||||
</h2>
|
||||
<p className="mt-2 text-center text-sm text-slate-500 uppercase tracking-widest font-semibold">
|
||||
Accès restreint
|
||||
</p>
|
||||
</div>
|
||||
<LogoGise />
|
||||
|
||||
{/* BOÎTE CENTRALE DÉCLINÉE AVEC NOTRE OBJET CARD */}
|
||||
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
|
||||
<Card className="shadow-sm border-slate-200">
|
||||
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md justify-center flex">
|
||||
<Card>
|
||||
<CardContent className="p-6 sm:p-10">
|
||||
|
||||
|
||||
{/* AFFICHAGE DES ERREURS GLOBALES */}
|
||||
{error && (
|
||||
<div className="mb-6 bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-md text-sm font-medium animate-in fade-in slide-in-from-top-1">
|
||||
@@ -47,32 +37,28 @@ export default function Login({ onLoginSuccess }: LoginProps) {
|
||||
|
||||
{/* ROUTAGE INTERNE DES ÉTAPES */}
|
||||
{step === 1 ? (
|
||||
<div className="space-y-6">
|
||||
<button
|
||||
<div className="space-y-6 items-center">
|
||||
<Button
|
||||
type="button"
|
||||
onClick={loginWithZitadel}
|
||||
disabled={isLoading}
|
||||
className="flex w-full justify-center items-center rounded-md border border-slate-300 bg-white py-2.5 px-4 text-sm font-semibold text-slate-700 shadow-sm hover:bg-slate-50 focus:outline-none transition-colors disabled:opacity-70 cursor-pointer"
|
||||
>
|
||||
<svg className="w-5 h-5 mr-2 text-blue-900" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
|
||||
</svg>
|
||||
leftIcon={<GlobeLock className="w-5 h-5 mr-2 text-blue-900" />}>
|
||||
{isLoading ? 'Connexion en cours...' : 'Connexion via GISE Identity'}
|
||||
</button>
|
||||
</Button>
|
||||
|
||||
<div className="relative">
|
||||
<div className="absolute inset-0 flex items-center">
|
||||
<div className="w-full border-t border-slate-200" />
|
||||
</div>
|
||||
<div className="relative flex justify-center text-sm">
|
||||
<span className="bg-white px-2 text-slate-400">Ou via vos identifiants locaux</span>
|
||||
<Badge name="Ou via authentification classique"></Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LocalLoginForm onSubmit={loginWithLocal} isLoading={isLoading} />
|
||||
</div>
|
||||
) : (
|
||||
<MfaForm
|
||||
<MfaForm
|
||||
isFirstSetup={mfaConfig?.isFirstSetup || false}
|
||||
qrUrl={mfaConfig?.qrUrl || ''}
|
||||
isLoading={isLoading}
|
||||
|
||||
Reference in New Issue
Block a user