1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-13 17:25:34 +01:00

Fix autocomplete attribute in PasswordInput

This commit is contained in:
Aleksandr Gumroian 2022-01-25 18:49:43 +03:00
parent 2bcbe0ae59
commit 4b239ed195
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733

View File

@ -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.
* See /LICENSE for more information.
@ -21,14 +21,17 @@ PasswordInput.propTypes = {
helpText: PropTypes.string,
/** Use show/hide password button. */
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);
return (
<Input
type={withEye && !isHidden ? "text" : "password"}
autoComplete={isHidden ? "new-password" : null}
autoComplete={newPass ? "new-password" : "current-password"}
{...props}
>
{withEye ? (