mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-09 10:03:36 +00:00
feat: hide passwords while typing
This commit is contained in:
parent
74c8312589
commit
9b58e13bac
@ -8,6 +8,8 @@ const KeystoreFiles = () => {
|
||||
const [confirmEncryptedPassword, setConfirmEncryptedPassword] = useState('')
|
||||
const [encryptedPasswordError, setEncryptedPasswordError] = useState(false)
|
||||
const [confirmEncryptedPasswordError, setConfirmEncryptedPasswordError] = useState(false)
|
||||
const [displayEncryptedPassword, setDisplayEncryptedPassword] = useState('')
|
||||
const [displayConfirmEncryptedPassword, setDisplayConfirmEncryptedPassword] = useState('')
|
||||
|
||||
const generateKeystoreFilesHandler = () => {
|
||||
if (
|
||||
@ -25,11 +27,15 @@ const KeystoreFiles = () => {
|
||||
}
|
||||
|
||||
const changeEncryptedPasswordHandler = (e: any) => {
|
||||
setEncryptedPassword(e.target.value)
|
||||
const password = e.target.value
|
||||
setEncryptedPassword(password)
|
||||
setDisplayEncryptedPassword(getHidedPassword(password.length))
|
||||
}
|
||||
|
||||
const changeConfirmEncryptedPasswordHandler = (e: any) => {
|
||||
setConfirmEncryptedPassword(e.target.value)
|
||||
const password = e.target.value
|
||||
setConfirmEncryptedPassword(password)
|
||||
setDisplayConfirmEncryptedPassword(getHidedPassword(password.length))
|
||||
}
|
||||
|
||||
const clearEncryptedPasswordHandler = () => {
|
||||
@ -49,6 +55,10 @@ const KeystoreFiles = () => {
|
||||
element.click()
|
||||
}
|
||||
|
||||
const getHidedPassword = (passwordLength: number) => {
|
||||
return '*'.repeat(passwordLength)
|
||||
}
|
||||
|
||||
return (
|
||||
<YStack space={'$4'}>
|
||||
<XStack space={'$2'} style={{ justifyContent: 'space-between', width: '100%' }}>
|
||||
@ -68,7 +78,7 @@ const KeystoreFiles = () => {
|
||||
/>
|
||||
}
|
||||
error={encryptedPasswordError}
|
||||
value={encryptedPassword}
|
||||
value={displayEncryptedPassword}
|
||||
onChange={changeEncryptedPasswordHandler}
|
||||
/>
|
||||
</YStack>
|
||||
@ -87,7 +97,7 @@ const KeystoreFiles = () => {
|
||||
/>
|
||||
}
|
||||
error={confirmEncryptedPasswordError}
|
||||
value={confirmEncryptedPassword}
|
||||
value={displayConfirmEncryptedPassword}
|
||||
onChange={changeConfirmEncryptedPasswordHandler}
|
||||
/>
|
||||
</YStack>
|
||||
|
Loading…
x
Reference in New Issue
Block a user