1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 15:38:15 +00:00

[system admin] users: fixup for 'add user' (#4254)

This commit is contained in:
llj
2019-11-15 06:58:19 +08:00
committed by Daniel Pan
parent 8eb5d9b50b
commit dfa8deb1fa

View File

@@ -29,9 +29,9 @@ class SysAdminAddUserDialog extends React.Component {
checkSubmitBtnActive = () => { checkSubmitBtnActive = () => {
const { email, password, passwordAgain } = this.state; const { email, password, passwordAgain } = this.state;
let btnActive = true; let btnActive = true;
if (email != '' && if (email.trim() &&
password != '' && password.trim() &&
passwordAgain != '') { passwordAgain.trim()) {
btnActive = true; btnActive = true;
} else { } else {
btnActive = false; btnActive = false;
@@ -50,7 +50,7 @@ class SysAdminAddUserDialog extends React.Component {
} }
inputPassword = (e) => { inputPassword = (e) => {
let passwd = e.target.value.trim(); let passwd = e.target.value;
this.setState({ this.setState({
password: passwd, password: passwd,
errorMsg: '' errorMsg: ''
@@ -58,7 +58,7 @@ class SysAdminAddUserDialog extends React.Component {
} }
inputPasswordAgain = (e) => { inputPasswordAgain = (e) => {
let passwd = e.target.value.trim(); let passwd = e.target.value;
this.setState({ this.setState({
passwordAgain: passwd, passwordAgain: passwd,
errorMsg: '' errorMsg: ''
@@ -74,14 +74,14 @@ class SysAdminAddUserDialog extends React.Component {
} }
inputEmail = (e) => { inputEmail = (e) => {
let email = e.target.value.trim(); let email = e.target.value;
this.setState({ this.setState({
email: email email: email
}, this.checkSubmitBtnActive); }, this.checkSubmitBtnActive);
} }
inputName = (e) => { inputName = (e) => {
let name = e.target.value.trim(); let name = e.target.value;
this.setState({ this.setState({
name: name name: name
}); });
@@ -100,9 +100,9 @@ class SysAdminAddUserDialog extends React.Component {
return; return;
} }
let data = { let data = {
email: email, email: email.trim(),
name: name, name: name.trim(),
password: password password: password.trim()
}; };
if (this.props.showRole) { if (this.props.showRole) {
data.role = role; data.role = role;
@@ -131,12 +131,12 @@ class SysAdminAddUserDialog extends React.Component {
<Label>{gettext('Name(optional)')}</Label> <Label>{gettext('Name(optional)')}</Label>
<Input type="text" value={name} onChange={this.inputName} /> <Input type="text" value={name} onChange={this.inputName} />
</FormGroup> </FormGroup>
{showRole && {showRole &&
<FormGroup> <FormGroup>
<Label> <Label>
{gettext('Role')} {gettext('Role')}
<span className="small text-secondary ml-1 fas fa-question-circle" title={gettext('You can also add a user as a guest, who will not be allowed to create libraries and groups.')}></span> <span className="small text-secondary ml-1 fas fa-question-circle" title={gettext('You can also add a user as a guest, who will not be allowed to create libraries and groups.')}></span>
</Label> </Label>
<SysAdminUserRoleEditor <SysAdminUserRoleEditor
isTextMode={false} isTextMode={false}
isEditIconShow={false} isEditIconShow={false}
@@ -145,7 +145,7 @@ class SysAdminAddUserDialog extends React.Component {
onRoleChanged={this.updateRole} onRoleChanged={this.updateRole}
/> />
</FormGroup> </FormGroup>
} }
<FormGroup> <FormGroup>
<Label>{gettext('Password')}</Label> <Label>{gettext('Password')}</Label>
<InputGroup> <InputGroup>