mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +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 = () => {
|
isValid = () => {
|
||||||
const user = this.state.user;
|
const user = this.state.user;
|
||||||
|
const passwordValid = this.props.user ? !this.isFalsy(user.password) : true;
|
||||||
return !(
|
return !(
|
||||||
this.state.nameValidationError ||
|
this.state.nameValidationError ||
|
||||||
this.state.mailValidationError ||
|
this.state.mailValidationError ||
|
||||||
@@ -68,7 +69,7 @@ class UserForm extends React.Component<Props, State> {
|
|||||||
this.isFalsy(user.name) ||
|
this.isFalsy(user.name) ||
|
||||||
this.isFalsy(user.displayName) ||
|
this.isFalsy(user.displayName) ||
|
||||||
this.isFalsy(user.mail) ||
|
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;
|
const user = this.state.user;
|
||||||
|
|
||||||
let nameField = null;
|
let nameField = null;
|
||||||
|
let passwordChangeField = null;
|
||||||
if (!this.props.user) {
|
if (!this.props.user) {
|
||||||
nameField = (
|
nameField = (
|
||||||
<InputField
|
<InputField
|
||||||
@@ -95,6 +97,10 @@ class UserForm extends React.Component<Props, State> {
|
|||||||
helpText={t("help.usernameHelpText")}
|
helpText={t("help.usernameHelpText")}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
passwordChangeField = (
|
||||||
|
<PasswordConfirmation passwordChanged={this.handlePasswordChange} />
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<form onSubmit={this.submit}>
|
<form onSubmit={this.submit}>
|
||||||
@@ -115,7 +121,7 @@ class UserForm extends React.Component<Props, State> {
|
|||||||
errorMessage={t("validation.mail-invalid")}
|
errorMessage={t("validation.mail-invalid")}
|
||||||
helpText={t("help.mailHelpText")}
|
helpText={t("help.mailHelpText")}
|
||||||
/>
|
/>
|
||||||
<PasswordConfirmation passwordChanged={this.handlePasswordChange} />
|
{passwordChangeField}
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={t("user.admin")}
|
label={t("user.admin")}
|
||||||
onChange={this.handleAdminChange}
|
onChange={this.handleAdminChange}
|
||||||
|
|||||||
Reference in New Issue
Block a user