Signin: modern split-panel with Seubert logo, MS SSO primary, remove dev accounts, local login collapsed

This commit is contained in:
lorentz 2026-04-13 01:55:47 +00:00
parent 6117b23123
commit 3f44adc8bc
3 changed files with 117 additions and 83 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

@ -1,21 +1,56 @@
import { SignInForm } from '@/components/auth/signin-form' import { SignInForm } from '@/components/auth/signin-form'
import Image from 'next/image'
export default function SignInPage() { export default function SignInPage() {
return ( return (
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100"> <div className="min-h-screen flex">
<div className="max-w-md w-full"> {/* Left panel — brand */}
<div className="bg-white shadow-xl rounded-lg p-8"> <div className="hidden lg:flex lg:w-1/2 flex-col justify-between p-12"
<div className="text-center mb-8"> style={{ background: 'linear-gradient(160deg, #0F513F 0%, #15745a 60%, #1FA883 100%)' }}>
<h1 className="text-3xl font-bold text-gray-900">Horizon</h1> <div>
<p className="text-gray-600 mt-2">Policy Renewal Workflow Management</p> <Image
src="/seubert-logo.webp"
alt="Seubert"
width={180}
height={56}
className="brightness-0 invert"
priority
/>
</div>
<div>
<h2 className="text-4xl font-bold text-white leading-tight">
Policy Renewal<br />Workflow Management
</h2>
<p className="mt-4 text-white/70 text-lg">
Horizon keeps your team on top of every renewal, every client, every deadline.
</p>
</div>
<p className="text-white/40 text-sm">
© {new Date().getFullYear()} Seubert Enterprises, Inc.
</p>
</div>
{/* Right panel — form */}
<div className="flex-1 flex flex-col items-center justify-center px-6 py-12 bg-white">
<div className="w-full max-w-sm">
{/* Mobile logo */}
<div className="flex justify-center mb-8 lg:hidden">
<Image
src="/seubert-logo.webp"
alt="Seubert"
width={150}
height={48}
priority
/>
</div> </div>
<div className="mb-8">
<h1 className="text-2xl font-bold text-gray-900">Welcome back</h1>
<p className="text-gray-500 mt-1 text-sm">Sign in to your Horizon account</p>
</div>
<SignInForm /> <SignInForm />
</div> </div>
<p className="text-center text-sm text-gray-600 mt-4">
Sign in with your local account or Microsoft account
</p>
</div> </div>
</div> </div>
) )

View file

@ -4,26 +4,21 @@ import { useState } from 'react'
import { signIn } from 'next-auth/react' import { signIn } from 'next-auth/react'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Loader2 } from 'lucide-react'
import { Building2, User } from 'lucide-react'
export function SignInForm() { export function SignInForm() {
const [username, setUsername] = useState('') const [username, setUsername] = useState('')
const [password, setPassword] = useState('') const [password, setPassword] = useState('')
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [msLoading, setMsLoading] = useState(false)
const [error, setError] = useState('') const [error, setError] = useState('')
const [showLocal, setShowLocal] = useState(false)
const handleLocalSignIn = async (e: React.FormEvent) => { const handleLocalSignIn = async (e: React.FormEvent) => {
e.preventDefault() e.preventDefault()
setLoading(true) setLoading(true)
setError('') setError('')
const result = await signIn('credentials', { username, password, redirect: false })
const result = await signIn('credentials', {
username,
password,
redirect: false,
})
if (result?.error) { if (result?.error) {
setError('Invalid username or password') setError('Invalid username or password')
setLoading(false) setLoading(false)
@ -33,76 +28,80 @@ export function SignInForm() {
} }
const handleMicrosoftSignIn = async () => { const handleMicrosoftSignIn = async () => {
setMsLoading(true)
await signIn('azure-ad', { callbackUrl: '/dashboard' }) await signIn('azure-ad', { callbackUrl: '/dashboard' })
} }
return ( return (
<div className="space-y-4"> <div className="space-y-4">
{/* Local Account Login */} {/* Microsoft SSO — primary */}
<Card> <Button
<CardHeader> onClick={handleMicrosoftSignIn}
<CardTitle className="text-lg flex items-center gap-2"> disabled={msLoading}
<User className="h-5 w-5" /> className="w-full h-11 text-sm font-medium"
Local Account style={{ backgroundColor: '#0F513F' }}
</CardTitle> size="lg"
</CardHeader> >
<CardContent> {msLoading ? (
<form onSubmit={handleLocalSignIn} className="space-y-4"> <Loader2 className="mr-2 h-4 w-4 animate-spin" />
<div> ) : (
<Input <svg className="mr-2 h-4 w-4" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">
type="text" <rect x="1" y="1" width="9" height="9" fill="#f25022"/>
placeholder="Username" <rect x="11" y="1" width="9" height="9" fill="#7fba00"/>
value={username} <rect x="1" y="11" width="9" height="9" fill="#00a4ef"/>
onChange={(e) => setUsername(e.target.value)} <rect x="11" y="11" width="9" height="9" fill="#ffb900"/>
disabled={loading} </svg>
required )}
/> Sign in with Microsoft
</div> </Button>
<div>
<Input
type="password"
placeholder="Password"
value={password}
onChange={(e) => setPassword(e.target.value)}
disabled={loading}
required
/>
</div>
{error && (
<p className="text-sm text-red-500">{error}</p>
)}
<Button
type="submit"
className="w-full"
disabled={loading}
>
{loading ? 'Signing in...' : 'Sign In'}
</Button>
</form>
<div className="mt-4 p-3 bg-blue-50 rounded text-xs text-blue-800">
<p className="font-semibold mb-1">Development Accounts:</p>
<p> admin / admin123 (Admin)</p>
<p> manager / manager123 (Manager)</p>
<p> ae / ae123 (Account Executive)</p>
</div>
</CardContent>
</Card>
{/* Microsoft Login (if configured) */} {/* Divider */}
<Card> <div className="relative">
<CardContent className="pt-6"> <div className="absolute inset-0 flex items-center">
<Button <span className="w-full border-t border-gray-200" />
onClick={handleMicrosoftSignIn} </div>
variant="outline" <div className="relative flex justify-center text-xs">
className="w-full" <span className="bg-white px-3 text-gray-400">or</span>
size="lg" </div>
> </div>
<Building2 className="mr-2 h-5 w-5" />
Sign in with Microsoft {/* Local credentials — secondary / collapsed */}
{!showLocal ? (
<button
type="button"
onClick={() => setShowLocal(true)}
className="w-full text-center text-xs text-gray-400 hover:text-gray-600 transition-colors py-1"
>
Sign in with local account
</button>
) : (
<form onSubmit={handleLocalSignIn} className="space-y-3">
<Input
type="text"
placeholder="Username"
value={username}
onChange={(e) => setUsername(e.target.value)}
disabled={loading}
required
autoFocus
className="h-10"
/>
<Input
type="password"
placeholder="Password"
value={password}
onChange={(e) => setPassword(e.target.value)}
disabled={loading}
required
className="h-10"
/>
{error && <p className="text-xs text-red-500">{error}</p>}
<Button type="submit" variant="outline" className="w-full h-10" disabled={loading}>
{loading ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : null}
{loading ? 'Signing in…' : 'Sign In'}
</Button> </Button>
</CardContent> </form>
</Card> )}
</div> </div>
) )
} }