feat: add error for not matching passwords
This commit is contained in:
parent
fc5492072a
commit
74c8312589
|
@ -6,8 +6,23 @@ import { useState } from 'react'
|
||||||
const KeystoreFiles = () => {
|
const KeystoreFiles = () => {
|
||||||
const [encryptedPassword, setEncryptedPassword] = useState('')
|
const [encryptedPassword, setEncryptedPassword] = useState('')
|
||||||
const [confirmEncryptedPassword, setConfirmEncryptedPassword] = useState('')
|
const [confirmEncryptedPassword, setConfirmEncryptedPassword] = useState('')
|
||||||
|
const [encryptedPasswordError, setEncryptedPasswordError] = useState(false)
|
||||||
|
const [confirmEncryptedPasswordError, setConfirmEncryptedPasswordError] = useState(false)
|
||||||
|
|
||||||
const generateKeystoreFilesHandler = () => {}
|
const generateKeystoreFilesHandler = () => {
|
||||||
|
if (
|
||||||
|
encryptedPassword !== confirmEncryptedPassword ||
|
||||||
|
encryptedPassword === '' ||
|
||||||
|
confirmEncryptedPassword === ''
|
||||||
|
) {
|
||||||
|
setEncryptedPasswordError(true)
|
||||||
|
setConfirmEncryptedPasswordError(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setEncryptedPasswordError(false)
|
||||||
|
setConfirmEncryptedPasswordError(false)
|
||||||
|
}
|
||||||
|
|
||||||
const changeEncryptedPasswordHandler = (e: any) => {
|
const changeEncryptedPasswordHandler = (e: any) => {
|
||||||
setEncryptedPassword(e.target.value)
|
setEncryptedPassword(e.target.value)
|
||||||
|
@ -52,6 +67,7 @@ const KeystoreFiles = () => {
|
||||||
onClick={clearEncryptedPasswordHandler}
|
onClick={clearEncryptedPasswordHandler}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
error={encryptedPasswordError}
|
||||||
value={encryptedPassword}
|
value={encryptedPassword}
|
||||||
onChange={changeEncryptedPasswordHandler}
|
onChange={changeEncryptedPasswordHandler}
|
||||||
/>
|
/>
|
||||||
|
@ -70,6 +86,7 @@ const KeystoreFiles = () => {
|
||||||
onClick={clearConfirmEncryptedPasswordHandler}
|
onClick={clearConfirmEncryptedPasswordHandler}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
error={confirmEncryptedPasswordError}
|
||||||
value={confirmEncryptedPassword}
|
value={confirmEncryptedPassword}
|
||||||
onChange={changeConfirmEncryptedPasswordHandler}
|
onChange={changeConfirmEncryptedPasswordHandler}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue