Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
"use client";
|
|
|
|
import { Input } from "@/app/components/ui/input";
|
|
import { Label } from "@/app/components/ui/label";
|
|
import { useT } from "@/app/lib/i18n/MessagesProvider";
|
|
|
|
/** Password + confirmation inputs shared by the create form and "Set temporary password". */
|
|
export function PasswordFields(props: {
|
|
password: string;
|
|
confirmPassword: string;
|
|
onPassword: (v: string) => void;
|
|
onConfirmPassword: (v: string) => void;
|
|
disabled?: boolean;
|
|
passwordError?: string;
|
|
confirmError?: string;
|
|
}) {
|
|
const t = useT();
|
|
return (
|
|
<>
|
|
<div className="space-y-1.5">
|
|
<Label htmlFor="user-password">{t("Password")}</Label>
|
|
<Input
|
|
id="user-password"
|
|
type="password"
|
|
autoComplete="new-password"
|
|
value={props.password}
|
|
onChange={(e) => props.onPassword(e.target.value)}
|
|
disabled={props.disabled}
|
|
aria-invalid={!!props.passwordError}
|
|
aria-describedby="user-password-hint"
|
|
/>
|
|
<p id="user-password-hint" className="text-sm text-muted-foreground">{t("AdminPasswordHint")}</p>
|
|
{props.passwordError && <p role="alert" className="text-sm text-destructive">{props.passwordError}</p>}
|
|
</div>
|
|
<div className="space-y-1.5">
|
|
<Label htmlFor="user-confirm-password">{t("UsrConfirmPassword")}</Label>
|
|
<Input
|
|
id="user-confirm-password"
|
|
type="password"
|
|
autoComplete="new-password"
|
|
value={props.confirmPassword}
|
|
onChange={(e) => props.onConfirmPassword(e.target.value)}
|
|
disabled={props.disabled}
|
|
aria-invalid={!!props.confirmError}
|
|
/>
|
|
{props.confirmError && <p role="alert" className="text-sm text-destructive">{props.confirmError}</p>}
|
|
</div>
|
|
</>
|
|
);
|
|
}
|