fixed password validation in ui

This commit is contained in:
Sebastian Sdorra
2018-12-06 12:00:30 +01:00
parent 226dc75ddc
commit 2c0d40c184
4 changed files with 32 additions and 24 deletions

View File

@@ -11,7 +11,7 @@ type State = {
passwordConfirmationFailed: boolean
};
type Props = {
passwordChanged: string => void,
passwordChanged: (string, boolean) => void,
passwordValidator?: string => boolean,
// Context props
t: string => string
@@ -98,14 +98,12 @@ class PasswordConfirmation extends React.Component<Props, State> {
);
};
isValid = () => {
return this.state.passwordValid && !this.state.passwordConfirmationFailed
};
propagateChange = () => {
if (
this.state.password &&
this.state.passwordValid &&
!this.state.passwordConfirmationFailed
) {
this.props.passwordChanged(this.state.password);
}
this.props.passwordChanged(this.state.password, this.isValid());
};
}