mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 02:06:18 +01:00
Fixes input dialog for password field (#1934)
Fixes an javascript error in the create user dialog where the "event" from the password field is a simple string, no event.
This commit is contained in:
2
gradle/changelog/password_field.yaml
Normal file
2
gradle/changelog/password_field.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
- type: fixed
|
||||||
|
description: Password field in "Create User" dialog and other ((#1934)[https://github.com/scm-manager/scm-manager/pull/1934])
|
||||||
@@ -58,7 +58,13 @@ const PasswordConfirmation: FC<InnerProps> = ({ passwordChanged, passwordValidat
|
|||||||
setPasswordConfirmationFailed(password !== newConfirmedPassword);
|
setPasswordConfirmationFailed(password !== newConfirmedPassword);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePasswordChange = (newPassword: string) => {
|
const handlePasswordChange = (event: React.ChangeEvent<HTMLInputElement> | string) => {
|
||||||
|
let newPassword;
|
||||||
|
if (typeof event === "string") {
|
||||||
|
newPassword = event;
|
||||||
|
} else {
|
||||||
|
newPassword = event.target.value;
|
||||||
|
}
|
||||||
setPasswordConfirmationFailed(newPassword !== confirmedPassword);
|
setPasswordConfirmationFailed(newPassword !== confirmedPassword);
|
||||||
setPassword(newPassword);
|
setPassword(newPassword);
|
||||||
setPasswordValid(validatePassword(newPassword));
|
setPasswordValid(validatePassword(newPassword));
|
||||||
@@ -70,7 +76,7 @@ const PasswordConfirmation: FC<InnerProps> = ({ passwordChanged, passwordValidat
|
|||||||
<InputField
|
<InputField
|
||||||
label={t("password.newPassword")}
|
label={t("password.newPassword")}
|
||||||
type="password"
|
type="password"
|
||||||
onChange={event => handlePasswordChange(event.target.value)}
|
onChange={event => handlePasswordChange(event)}
|
||||||
value={password}
|
value={password}
|
||||||
validationError={!passwordValid}
|
validationError={!passwordValid}
|
||||||
errorMessage={t("password.passwordInvalid")}
|
errorMessage={t("password.passwordInvalid")}
|
||||||
|
|||||||
Reference in New Issue
Block a user