Merge pull request #1545 from riccardobl/passhide
Use -webkit-text-security to hide passphrase
This commit is contained in:
commit
281757dd81
@ -1188,17 +1188,24 @@ export function PasswordInput ({ newPass, qr, copy, readOnly, append, value, ...
|
|||||||
)
|
)
|
||||||
}, [showPass, copy, field?.value, qr, readOnly, append])
|
}, [showPass, copy, field?.value, qr, readOnly, append])
|
||||||
|
|
||||||
const maskedValue = !showPass && props.as === 'textarea' ? field?.value?.replace(/./g, '•') : field?.value
|
const style = props.style ? { ...props.style } : {}
|
||||||
|
if (props.as === 'textarea') {
|
||||||
|
if (!showPass) {
|
||||||
|
style.WebkitTextSecurity = 'disc'
|
||||||
|
} else {
|
||||||
|
if (style.WebkitTextSecurity) delete style.WebkitTextSecurity
|
||||||
|
}
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<ClientInput
|
<ClientInput
|
||||||
{...props}
|
{...props}
|
||||||
|
style={style}
|
||||||
className={styles.passwordInput}
|
className={styles.passwordInput}
|
||||||
type={showPass ? 'text' : 'password'}
|
type={showPass ? 'text' : 'password'}
|
||||||
autoComplete={newPass ? 'new-password' : 'current-password'}
|
autoComplete={newPass ? 'new-password' : 'current-password'}
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
append={props.as === 'textarea' ? undefined : Append}
|
append={props.as === 'textarea' ? undefined : Append}
|
||||||
value={maskedValue}
|
value={field?.value}
|
||||||
under={props.as === 'textarea'
|
under={props.as === 'textarea'
|
||||||
? (
|
? (
|
||||||
<div className='mt-2 d-flex justify-content-end' style={{ gap: '8px' }}>
|
<div className='mt-2 d-flex justify-content-end' style={{ gap: '8px' }}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user