This commit is contained in:
Debian
2026-03-30 14:24:39 +00:00
parent dec232212d
commit 87198824b6
15 changed files with 178 additions and 216 deletions
+8 -21
View File
@@ -3,18 +3,16 @@ import { useState, type FormEvent } from "react";
type LoginPageProps = {
busy: boolean;
error: string | null;
onSubmit: (payload: { email: string; password: string }) => Promise<void>;
onSubmit: (payload: { accessKey: string }) => Promise<void>;
};
export default function LoginPage({ busy, error, onSubmit }: LoginPageProps) {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [accessKey, setAccessKey] = useState("");
const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
await onSubmit({
email: email.trim().toLowerCase(),
password
accessKey: accessKey.trim()
});
};
@@ -24,29 +22,18 @@ export default function LoginPage({ busy, error, onSubmit }: LoginPageProps) {
<div className="eyebrow">Docker Mailserver</div>
<h1>Mail user management</h1>
<p className="auth-copy">
Sign in with the admin account configured for this panel.
Sign in with the access key configured for this panel.
</p>
<form className="stack" onSubmit={handleSubmit}>
<label className="field">
<span>Admin email</span>
<input
type="email"
value={email}
onChange={(event) => setEmail(event.target.value)}
autoComplete="username"
autoFocus
disabled={busy}
/>
</label>
<label className="field">
<span>Password</span>
<span>Access key</span>
<input
type="password"
value={password}
onChange={(event) => setPassword(event.target.value)}
value={accessKey}
onChange={(event) => setAccessKey(event.target.value)}
autoComplete="current-password"
autoFocus
disabled={busy}
/>
</label>