mirror of
https://github.com/Since-3/since3-portal.git
synced 2026-10-12 20:51:17 +00:00
76 lines
No EOL
3.4 KiB
TypeScript
76 lines
No EOL
3.4 KiB
TypeScript
"use client"
|
|
|
|
import { useActionState, useState } from "react"
|
|
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
|
|
import { Eye, EyeOff, Lock, User } from 'lucide-react';
|
|
import { Input } from "@/components/ui/input"
|
|
import Image from "next/image"
|
|
import { Button } from "@/components/ui/button";
|
|
import { login } from "../../actions/auth";
|
|
|
|
const LoginPageView = () => {
|
|
const [showPassword, setShowPassword] = useState(false)
|
|
const [state, formAction, pending] = useActionState(login, undefined);
|
|
|
|
return (
|
|
<div className="bg-background h-screen p-6">
|
|
<Image
|
|
src="/pictures/since3-logo.svg" alt=""
|
|
width={1617}
|
|
height={332}
|
|
loading="eager"
|
|
className="h-5 w-auto md:h-6"/>
|
|
<div className="flex flex-col h-full items-center justify-center">
|
|
<h1 className="mb-6 text-3xl font-semibold">Login</h1>
|
|
<form action={formAction} className="w-full max-w-sm ">
|
|
<FieldGroup>
|
|
<Field>
|
|
<FieldLabel htmlFor="form-email"><User className="w-4 h-4"/> Email <span className="text-destructive">*</span></FieldLabel>
|
|
<Input
|
|
id="form-email"
|
|
name="email"
|
|
type="text"
|
|
className="bg-white focus-visible:ring-0"
|
|
required
|
|
/>
|
|
</Field>
|
|
<Field>
|
|
<FieldLabel htmlFor="form-password"><Lock className="w-4 h-4"/> Password <span className="text-destructive">*</span></FieldLabel>
|
|
<div className="relative">
|
|
<Input
|
|
id="form-password"
|
|
name="password"
|
|
type={showPassword ? "text" : "password"}
|
|
className="bg-white focus-visible:ring-0 pr-10"
|
|
required
|
|
/>
|
|
<button
|
|
type="button"
|
|
onClick={() => setShowPassword((prev) => !prev)}
|
|
className="absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground"
|
|
aria-label={showPassword ? "Passwort verbergen" : "Passwort anzeigen"}
|
|
tabIndex={-1}
|
|
>
|
|
{showPassword ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
|
|
</button>
|
|
</div>
|
|
</Field>
|
|
<Field>
|
|
{state?.error && (
|
|
<p className="text-sm text-destructive">{state.error}</p>
|
|
)}
|
|
<Button type="submit" disabled={pending} className="cursor-pointer">
|
|
{pending ? "Bitte warten..." : "Login"}
|
|
</Button>
|
|
</Field>
|
|
</FieldGroup>
|
|
</form>
|
|
</div>
|
|
<div className="absolute bottom-2">
|
|
<p className="text-accent-400 text-sm">Bei Fragen: <a href="mailto:info@since3.de" className="underline">info@since3.de</a></p>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default LoginPageView |