mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-26 00:21:36 +01:00
Merge branch 'improve-password-inputs' into 'dev'
Fix autocomplete attribute in PasswordInput Closes #23 See merge request turris/reforis/foris-js!179
This commit is contained in:
commit
01eeb06f9e
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
* Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
||||||
*
|
*
|
||||||
* This is free software, licensed under the GNU General Public License v3.
|
* This is free software, licensed under the GNU General Public License v3.
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
|
@ -21,14 +21,17 @@ PasswordInput.propTypes = {
|
||||||
helpText: PropTypes.string,
|
helpText: PropTypes.string,
|
||||||
/** Use show/hide password button. */
|
/** Use show/hide password button. */
|
||||||
withEye: PropTypes.bool,
|
withEye: PropTypes.bool,
|
||||||
|
/** Use new-password in autocomplete attribute. */
|
||||||
|
newPass: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function PasswordInput({ withEye, ...props }) {
|
export function PasswordInput({ withEye, newPass, ...props }) {
|
||||||
const [isHidden, setHidden] = useState(true);
|
const [isHidden, setHidden] = useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
type={withEye && !isHidden ? "text" : "password"}
|
type={withEye && !isHidden ? "text" : "password"}
|
||||||
autoComplete={isHidden ? "new-password" : null}
|
autoComplete={newPass ? "new-password" : "current-password"}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{withEye ? (
|
{withEye ? (
|
||||||
|
|
|
@ -13,7 +13,7 @@ exports[`<PasswordInput/> Render password input 1`] = `
|
||||||
class="input-group"
|
class="input-group"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
autocomplete="new-password"
|
autocomplete="current-password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="1"
|
id="1"
|
||||||
type="password"
|
type="password"
|
||||||
|
|
|
@ -394,7 +394,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
+ class=\\"input-group\\"
|
+ class=\\"input-group\\"
|
||||||
+ >
|
+ >
|
||||||
+ <input
|
+ <input
|
||||||
+ autocomplete=\\"new-password\\"
|
+ autocomplete=\\"current-password\\"
|
||||||
+ class=\\"form-control is-invalid\\"
|
+ class=\\"form-control is-invalid\\"
|
||||||
+ id=\\"23\\"
|
+ id=\\"23\\"
|
||||||
+ required=\\"\\"
|
+ required=\\"\\"
|
||||||
|
@ -509,7 +509,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
|
||||||
+ class=\\"input-group\\"
|
+ class=\\"input-group\\"
|
||||||
+ >
|
+ >
|
||||||
+ <input
|
+ <input
|
||||||
+ autocomplete=\\"new-password\\"
|
+ autocomplete=\\"current-password\\"
|
||||||
+ class=\\"form-control\\"
|
+ class=\\"form-control\\"
|
||||||
+ id=\\"5\\"
|
+ id=\\"5\\"
|
||||||
+ required=\\"\\"
|
+ required=\\"\\"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user