mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
fix(frontend): add error prop to password input
Signed-off-by: Avinash <avinash.kumar.cs92@gmail.com>
This commit is contained in:
parent
58819f6018
commit
dae3b9d8dc
4 changed files with 24 additions and 8 deletions
|
@ -19,16 +19,21 @@ interface PasswordAgainFieldProps extends CommonFieldProps {
|
|||
* @param value The currently entered retype of the password.
|
||||
* @param password The password entered into the password input field.
|
||||
*/
|
||||
export const PasswordAgainField: React.FC<PasswordAgainFieldProps> = ({ onChange, value, password }) => {
|
||||
export const PasswordAgainField: React.FC<PasswordAgainFieldProps> = ({
|
||||
onChange,
|
||||
value,
|
||||
password,
|
||||
hasError = false
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const isInvalid = useMemo(() => {
|
||||
return value !== '' && password !== value
|
||||
}, [password, value])
|
||||
return value !== '' && password !== value && hasError
|
||||
}, [password, value, hasError])
|
||||
|
||||
const isValid = useMemo(() => {
|
||||
return password !== '' && password === value
|
||||
}, [password, value])
|
||||
return password !== '' && password === value && !hasError
|
||||
}, [password, value, hasError])
|
||||
|
||||
return (
|
||||
<Form.Group>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue