mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 15:23:29 +00:00
fix(ui): bake password-manager autofill guard into PasswordInput
Config/secret fields (BYOK API keys, webhook secrets, ntfy tokens) pass no autocomplete token, so PasswordInput now defaults to autoComplete=off plus data-bwignore / data-1p-ignore / data-lpignore for them — Bitwarden / 1Password / LastPass no longer offer to fill or save a config secret. Credential fields (login, register, password change) pass a real token and keep manager integration untouched. One change covers every secret call site.
This commit is contained in:
1 parent
dbc2b15b1b
commit
9f4c7e48fe
2 files changed
+58
No files matched your search
@@ -22,14 +22,28 @@ import { useTranslations } from "@/lib/i18n/context";
|
||||
*/
|
||||
export function PasswordInput({
|
||||
className,
|
||||
autoComplete,
|
||||
...props
|
||||
}: React.ComponentProps<typeof Input>) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const { t } = useTranslations();
|
||||
|
||||
// Config/secret fields (BYOK API keys, webhook secrets, ntfy tokens) pass no
|
||||
// `autoComplete` — they are not credentials, so a password manager offering
|
||||
// to fill or *save* them is noise and risks clobbering the field. Suppress
|
||||
// Bitwarden / 1Password / LastPass by default for those. Credential fields
|
||||
// (login, register, password change) pass a real token
|
||||
// (`current-password` / `new-password` / `username`) and keep manager
|
||||
// integration; only an explicit `"off"` opts back into suppression.
|
||||
const suppressManagers = autoComplete == null || autoComplete === "off";
|
||||
return (
|
||||
<div className="relative">
|
||||
<Input
|
||||
{...props}
|
||||
autoComplete={autoComplete ?? "off"}
|
||||
data-bwignore={suppressManagers ? "" : undefined}
|
||||
data-1p-ignore={suppressManagers ? "" : undefined}
|
||||
data-lpignore={suppressManagers ? "true" : undefined}
|
||||
type={visible ? "text" : "password"}
|
||||
className={cn("pr-12", className)}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user