mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
only enable submit button user changed something at editing
This commit is contained in:
@@ -61,17 +61,38 @@ class UserForm extends React.Component<Props, State> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isValid = () => {
|
createUserComponentsAreValid = () => {
|
||||||
const user = this.state.user;
|
const user = this.state.user;
|
||||||
|
if (!this.props.user) {
|
||||||
const createUserIsValid = !this.props.user
|
return (
|
||||||
? this.state.nameValidationError ||
|
this.state.nameValidationError ||
|
||||||
this.isFalsy(user.name) ||
|
this.isFalsy(user.name) ||
|
||||||
!this.state.passwordValid
|
!this.state.passwordValid
|
||||||
: false;
|
);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
editUserComponentsAreChanged = () => {
|
||||||
|
const user = this.state.user;
|
||||||
|
if (this.props.user) {
|
||||||
|
return (
|
||||||
|
this.props.user.displayName === user.displayName &&
|
||||||
|
this.props.user.mail === user.mail &&
|
||||||
|
this.props.user.admin === user.admin &&
|
||||||
|
this.props.user.active === user.active
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
isValid = () => {
|
||||||
|
const user = this.state.user;
|
||||||
return !(
|
return !(
|
||||||
createUserIsValid ||
|
this.createUserComponentsAreValid() ||
|
||||||
|
this.editUserComponentsAreChanged() ||
|
||||||
this.state.mailValidationError ||
|
this.state.mailValidationError ||
|
||||||
this.state.displayNameValidationError ||
|
this.state.displayNameValidationError ||
|
||||||
this.isFalsy(user.displayName) ||
|
this.isFalsy(user.displayName) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user