feat: add user authentication with livewire components

This commit is contained in:
jeremy bayse
2026-06-24 06:53:19 +02:00
parent 5b05dfa8c7
commit fa38396479
9 changed files with 368 additions and 11 deletions
@@ -0,0 +1,68 @@
<div>
<div class="mb-8 text-center">
<span class="px-3 py-1 bg-gradient-to-r from-cyan-500/10 to-indigo-500/10 border border-cyan-500/30 rounded-full text-xs font-bold tracking-wider text-cyan-400 uppercase">
Console Chatbot AGGLO
</span>
<h2 class="text-3xl font-extrabold tracking-tight mt-4 text-white">Connexion</h2>
<p class="text-slate-400 text-sm mt-2">Accédez à votre tableau de bord d'administration</p>
</div>
<div class="bg-slate-900/60 backdrop-blur-xl border border-slate-800 rounded-2xl p-8 shadow-2xl">
<form wire:submit.prevent="login" class="space-y-6">
<!-- Email -->
<div>
<label for="email" class="block text-sm font-medium text-slate-300">Adresse e-mail</label>
<div class="mt-1">
<input wire:model="email" type="email" id="email" autocomplete="email" required
class="w-full px-4 py-2.5 bg-slate-950/80 border border-slate-800 rounded-xl text-slate-100 placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 transition duration-200"
placeholder="nom@agglo-beziers.fr">
</div>
@error('email')
<span class="text-xs text-rose-400 mt-1 block">{{ $message }}</span>
@enderror
</div>
<!-- Mot de passe -->
<div>
<div class="flex items-center justify-between">
<label for="password" class="block text-sm font-medium text-slate-300">Mot de passe</label>
</div>
<div class="mt-1">
<input wire:model="password" type="password" id="password" autocomplete="current-password" required
class="w-full px-4 py-2.5 bg-slate-950/80 border border-slate-800 rounded-xl text-slate-100 placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 transition duration-200"
placeholder="••••••••">
</div>
@error('password')
<span class="text-xs text-rose-400 mt-1 block">{{ $message }}</span>
@enderror
</div>
<!-- Se souvenir de moi -->
<div class="flex items-center">
<input wire:model="remember" id="remember" type="checkbox"
class="h-4 w-4 rounded border-slate-800 bg-slate-950 text-cyan-600 focus:ring-cyan-500/50 focus:ring-offset-slate-900">
<label for="remember" class="ml-2 block text-sm text-slate-400 cursor-pointer select-none">Se souvenir de moi</label>
</div>
<!-- Bouton de soumission -->
<div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-xl text-sm font-semibold text-white bg-gradient-to-r from-cyan-500 to-indigo-600 hover:from-cyan-400 hover:to-indigo-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 active:scale-[0.98] transition-all duration-150 shadow-lg shadow-cyan-500/20">
<span wire:loading.remove wire:target="login">Se connecter</span>
<span wire:loading wire:target="login" class="flex items-center gap-2">
<svg class="animate-spin h-5 w-5 text-white" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
Connexion en cours...
</span>
</button>
</div>
</form>
<div class="mt-6 text-center text-sm border-t border-slate-800/80 pt-6">
<span class="text-slate-400">Pas encore de compte ?</span>
<a href="/register" class="font-medium text-cyan-400 hover:text-cyan-300 transition duration-150 ml-1">Créer un compte</a>
</div>
</div>
</div>
@@ -0,0 +1,82 @@
<div>
<div class="mb-8 text-center">
<span class="px-3 py-1 bg-gradient-to-r from-cyan-500/10 to-indigo-500/10 border border-cyan-500/30 rounded-full text-xs font-bold tracking-wider text-cyan-400 uppercase">
Console Chatbot AGGLO
</span>
<h2 class="text-3xl font-extrabold tracking-tight mt-4 text-white">Inscription</h2>
<p class="text-slate-400 text-sm mt-2">Créez votre compte administrateur</p>
</div>
<div class="bg-slate-900/60 backdrop-blur-xl border border-slate-800 rounded-2xl p-8 shadow-2xl">
<form wire:submit.prevent="register" class="space-y-5">
<!-- Nom -->
<div>
<label for="name" class="block text-sm font-medium text-slate-300">Nom complet</label>
<div class="mt-1">
<input wire:model="name" type="text" id="name" required autocomplete="name" autofocus
class="w-full px-4 py-2 bg-slate-950/80 border border-slate-800 rounded-xl text-slate-100 placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 transition duration-200"
placeholder="Jean Dupont">
</div>
@error('name')
<span class="text-xs text-rose-400 mt-1 block">{{ $message }}</span>
@enderror
</div>
<!-- Email -->
<div>
<label for="email" class="block text-sm font-medium text-slate-300">Adresse e-mail</label>
<div class="mt-1">
<input wire:model="email" type="email" id="email" required autocomplete="email"
class="w-full px-4 py-2 bg-slate-950/80 border border-slate-800 rounded-xl text-slate-100 placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 transition duration-200"
placeholder="nom@agglo-beziers.fr">
</div>
@error('email')
<span class="text-xs text-rose-400 mt-1 block">{{ $message }}</span>
@enderror
</div>
<!-- Mot de passe -->
<div>
<label for="password" class="block text-sm font-medium text-slate-300">Mot de passe</label>
<div class="mt-1">
<input wire:model="password" type="password" id="password" required autocomplete="new-password"
class="w-full px-4 py-2 bg-slate-950/80 border border-slate-800 rounded-xl text-slate-100 placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 transition duration-200"
placeholder="••••••••">
</div>
@error('password')
<span class="text-xs text-rose-400 mt-1 block">{{ $message }}</span>
@enderror
</div>
<!-- Confirmer le mot de passe -->
<div>
<label for="password_confirmation" class="block text-sm font-medium text-slate-300">Confirmer le mot de passe</label>
<div class="mt-1">
<input wire:model="password_confirmation" type="password" id="password_confirmation" required autocomplete="new-password"
class="w-full px-4 py-2 bg-slate-950/80 border border-slate-800 rounded-xl text-slate-100 placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 transition duration-200"
placeholder="••••••••">
</div>
</div>
<!-- Bouton de soumission -->
<div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-xl text-sm font-semibold text-white bg-gradient-to-r from-cyan-500 to-indigo-600 hover:from-cyan-400 hover:to-indigo-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 active:scale-[0.98] transition-all duration-150 shadow-lg shadow-cyan-500/20">
<span wire:loading.remove wire:target="register">Créer mon compte</span>
<span wire:loading wire:target="register" class="flex items-center gap-2">
<svg class="animate-spin h-5 w-5 text-white" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
Création du compte...
</span>
</button>
</div>
</form>
<div class="mt-6 text-center text-sm border-t border-slate-800/80 pt-6">
<span class="text-slate-400">Déjà inscrit ?</span>
<a href="/login" class="font-medium text-cyan-400 hover:text-cyan-300 transition duration-150 ml-1">Se connecter</a>
</div>
</div>
</div>