mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 23:15:43 +01:00
Don't show password field when editing a user
This commit is contained in:
@@ -61,6 +61,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
|
||||
isValid = () => {
|
||||
const user = this.state.user;
|
||||
const passwordValid = this.props.user ? !this.isFalsy(user.password) : true;
|
||||
return !(
|
||||
this.state.nameValidationError ||
|
||||
this.state.mailValidationError ||
|
||||
@@ -68,7 +69,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
this.isFalsy(user.name) ||
|
||||
this.isFalsy(user.displayName) ||
|
||||
this.isFalsy(user.mail) ||
|
||||
this.isFalsy(user.password)
|
||||
passwordValid
|
||||
);
|
||||
};
|
||||
|
||||
@@ -84,6 +85,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
const user = this.state.user;
|
||||
|
||||
let nameField = null;
|
||||
let passwordChangeField = null;
|
||||
if (!this.props.user) {
|
||||
nameField = (
|
||||
<InputField
|
||||
@@ -95,6 +97,10 @@ class UserForm extends React.Component<Props, State> {
|
||||
helpText={t("help.usernameHelpText")}
|
||||
/>
|
||||
);
|
||||
|
||||
passwordChangeField = (
|
||||
<PasswordConfirmation passwordChanged={this.handlePasswordChange} />
|
||||
);
|
||||
}
|
||||
return (
|
||||
<form onSubmit={this.submit}>
|
||||
@@ -115,7 +121,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
errorMessage={t("validation.mail-invalid")}
|
||||
helpText={t("help.mailHelpText")}
|
||||
/>
|
||||
<PasswordConfirmation passwordChanged={this.handlePasswordChange} />
|
||||
{passwordChangeField}
|
||||
<Checkbox
|
||||
label={t("user.admin")}
|
||||
onChange={this.handleAdminChange}
|
||||
|
||||
Reference in New Issue
Block a user