mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-10-04 02:04:17 +00:00
Disable password managers on some password forms (#503)
* Update index.tsx
add the data-lpignore attribute to the password component and remove redundant {} on autoComplete
* Update index.tsx
* add other password managers and disable ignore on main login
This commit is contained in:
@@ -8,6 +8,8 @@ type PasswdProps = JSX.IntrinsicElements["input"] & {
|
|||||||
locked?: boolean;
|
locked?: boolean;
|
||||||
/** This is optional in case an onChange override is necessary... */
|
/** This is optional in case an onChange override is necessary... */
|
||||||
setValue?: React.Dispatch<React.SetStateAction<string>>;
|
setValue?: React.Dispatch<React.SetStateAction<string>>;
|
||||||
|
/** Whether to ignore password managers */
|
||||||
|
ignorePasswordManager?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PasswdRef = HTMLInputElement;
|
type PasswdRef = HTMLInputElement;
|
||||||
@@ -22,16 +24,27 @@ export const Passwd = forwardRef<PasswdRef, PasswdProps>(
|
|||||||
setValue,
|
setValue,
|
||||||
placeholder,
|
placeholder,
|
||||||
locked = false,
|
locked = false,
|
||||||
|
ignorePasswordManager = true,
|
||||||
...restProps
|
...restProps
|
||||||
}: PasswdProps,
|
}: PasswdProps,
|
||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const [reveal, setReveal] = useState(false);
|
const [reveal, setReveal] = useState(false);
|
||||||
|
|
||||||
|
// Create object with conditional password manager attributes
|
||||||
|
const passwordManagerAttributes = ignorePasswordManager
|
||||||
|
? {
|
||||||
|
"data-lpignore": "true",
|
||||||
|
"data-1p-ignore": "",
|
||||||
|
"data-form-type": "other",
|
||||||
|
"data-bwignore": "",
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="passwd">
|
<div className="passwd">
|
||||||
<input
|
<input
|
||||||
autoComplete={"off"}
|
autoComplete="off"
|
||||||
ref={ref}
|
ref={ref}
|
||||||
type={reveal ? "text" : "password"}
|
type={reveal ? "text" : "password"}
|
||||||
name={name}
|
name={name}
|
||||||
@@ -43,6 +56,7 @@ export const Passwd = forwardRef<PasswdRef, PasswdProps>(
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
|
{...passwordManagerAttributes}
|
||||||
/>
|
/>
|
||||||
{!locked && (
|
{!locked && (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export const Login = () => {
|
|||||||
value={password}
|
value={password}
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
setValue={setPassword}
|
setValue={setPassword}
|
||||||
|
ignorePasswordManager={false}
|
||||||
/>
|
/>
|
||||||
{message && <Message message={message} />}
|
{message && <Message message={message} />}
|
||||||
<Button type="submit">Log in</Button>
|
<Button type="submit">Log in</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user