'use client' import { useState } from 'react' import { signIn } from 'next-auth/react' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Link2, Shield, Mail, Lock } from 'lucide-react' import Link from 'next/link' import { toast } from 'sonner' import { useRouter } from 'next/navigation' export function LoginClient({ oidcEnabled }: { oidcEnabled: boolean }) { // Client-owned integration point. Keep disabled until verified Authelia // identities are mapped to Go users in auth.ts's sign-in callback. const oidcReady = false const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [loading, setLoading] = useState(false) const router = useRouter() const handleEmailLogin = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) try { // signIn with redirect:false still rejects on network failures. const result = await signIn('credentials', { email, password, redirect: false }) if (result?.ok) { router.push('/pages') } else if (result?.code === 'throttled') { // Review M-8: Go's 429 is propagated as a CredentialsSignin code; // do not present throttling as a wrong password. toast.error('Too many attempts. Wait a few minutes and try again.') } else { toast.error('Invalid credentials') } } catch { toast.error('Sign-in failed; check your connection') } finally { setLoading(false) } } return (
Your personal binder of life on the web
Authelia single sign-on awaits client integration. Use email below.
)}Don't have an account? Sign up