1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 13:24:52 +00:00

Org add user bug (#3160)

* repair text to password bug

* info highlight bug repair

* repair bug
This commit is contained in:
杨顺强
2019-03-22 15:51:15 +08:00
committed by Daniel Pan
parent 0609f9b688
commit 485af61da2
2 changed files with 33 additions and 15 deletions

View File

@@ -21,6 +21,8 @@ class AddOrgUserDialog extends React.Component {
errMessage: '', errMessage: '',
isAddingUser: false, isAddingUser: false,
}; };
this.passwdInput = React.createRef();
this.passwdNewInput = React.createRef();
} }
handleSubmit = () => { handleSubmit = () => {
@@ -40,8 +42,14 @@ class AddOrgUserDialog extends React.Component {
}; };
togglePasswordVisible = () => { togglePasswordVisible = () => {
this.setState({ this.setState({isPasswordVisible: !this.state.isPasswordVisible}, () => {
isPasswordVisible: !this.state.isPasswordVisible if (this.state.isPasswordVisible) {
this.passwdInput.type = 'password';
this.passwdNewInput.type = 'password';
} else {
this.passwdInput.type = 'text';
this.passwdNewInput.type = 'text';
}
}); });
} }
@@ -49,7 +57,11 @@ class AddOrgUserDialog extends React.Component {
let val = Math.random().toString(36).substr(5); let val = Math.random().toString(36).substr(5);
this.setState({ this.setState({
password: val, password: val,
passwdnew: val passwdnew: val,
isPasswordVisible: false
}, () => {
this.passwdInput.type = 'text';
this.passwdNewInput.type = 'text';
}); });
} }
@@ -65,20 +77,26 @@ class AddOrgUserDialog extends React.Component {
inputPassword = (e) => { inputPassword = (e) => {
let passwd = e.target.value.trim(); let passwd = e.target.value.trim();
this.setState({password: passwd}); this.setState({password: passwd}, () => {
if (this.state.isPasswordVisible) {
this.passwdInput.type = 'password';
this.passwdNewInput.type = 'password';
}
});
} }
inputPasswordNew = (e) => { inputPasswordNew = (e) => {
let passwd = e.target.value.trim(); let passwd = e.target.value.trim();
this.setState({passwdnew: passwd}); this.setState({passwdnew: passwd}, () => {
if (this.state.isPasswordVisible) {
this.passwdInput.type = 'password';
this.passwdNewInput.type = 'password';
}
});
} }
toggle = () => { toggle = () => {
this.props.toggle(); this.props.toggle();
};
onInputTypeChange = () => {
this.setState({isPasswordVisible: false});
} }
validateInputParams() { validateInputParams() {
@@ -118,25 +136,25 @@ class AddOrgUserDialog extends React.Component {
<Form> <Form>
<FormGroup> <FormGroup>
<Label for="userEmail">{gettext('Email')}</Label> <Label for="userEmail">{gettext('Email')}</Label>
<Input id="userEmail" value={this.state.email || ''} onChange={this.inputEmail} autoComplete="off" /> <Input id="userEmail" value={this.state.email || ''} onChange={this.inputEmail} />
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<Label for="userName">{gettext('Name(optional)')}</Label> <Label for="userName">{gettext('Name(optional)')}</Label>
<Input id="userName" value={this.state.name || ''} onChange={this.inputName} autoComplete="off" /> <Input id="userName" value={this.state.name || ''} onChange={this.inputName} />
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<Label for="userPwd">{gettext('Password')}</Label> <Label for="userPwd">{gettext('Password')}</Label>
<InputGroup className="passwd"> <InputGroup className="passwd">
<Input id="userPwd" type={this.state.isPasswordVisible ? 'text' : 'password'} onFocus={this.onInputTypeChange} value={this.state.password || ''} onChange={this.inputPassword} autoComplete="off" /> <Input id="userPwd" innerRef={input => {this.passwdInput = input}} value={this.state.password || ''} onChange={this.inputPassword} />
<InputGroupAddon addonType="append"> <InputGroupAddon addonType="append">
<Button onClick={this.togglePasswordVisible}><i className={`link-operation-icon fas ${this.state.isPasswordVisible ? 'fa-eye': 'fa-eye-slash'}`}></i></Button> <Button onClick={this.togglePasswordVisible}><i className={`link-operation-icon fas ${this.state.isPasswordVisible ? 'fa-eye-slash' : 'fa-eye'}`}></i></Button>
<Button onClick={this.generatePassword}><i className="link-operation-icon fas fa-magic"></i></Button> <Button onClick={this.generatePassword}><i className="link-operation-icon fas fa-magic"></i></Button>
</InputGroupAddon> </InputGroupAddon>
</InputGroup> </InputGroup>
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<Label for="userPwdNew">{gettext('Confirm Password')}</Label> <Label for="userPwdNew">{gettext('Confirm Password')}</Label>
<Input id="userPwdNew" id="user" className="passwd" type={this.state.isPasswordVisible ? 'text' : 'password'} value={this.state.passwdnew || ''} onChange={this.inputPasswordNew} autoComplete="off" /> <Input id="userPwdNew" innerRef={input => {this.passwdNewInput = input}} className="passwd" value={this.state.passwdnew || ''} onChange={this.inputPasswordNew} />
</FormGroup> </FormGroup>
</Form> </Form>
<Label className="err-message">{gettext(this.state.errMessage)}</Label> <Label className="err-message">{gettext(this.state.errMessage)}</Label>

View File

@@ -33,7 +33,7 @@ class SidePanel extends React.Component {
<h3 className="sf-heading" style={{ 'color': '#f7941d' }}>{gettext('Admin')}</h3> <h3 className="sf-heading" style={{ 'color': '#f7941d' }}>{gettext('Admin')}</h3>
<ul className="nav nav-pills flex-column nav-container"> <ul className="nav nav-pills flex-column nav-container">
<li className="nav-item"> <li className="nav-item">
<Link className={`nav-link ellipsis ${this.getActiveClass('orginfo')}`} to={siteRoot + 'org/orgmanage/'} onClick={() => this.tabItemClick('orginfo')} > <Link className={`nav-link ellipsis ${this.getActiveClass('orgmanage')}`} to={siteRoot + 'org/orgmanage/'} onClick={() => this.tabItemClick('orgmanage')} >
<span className="sf2-icon-library"></span> <span className="sf2-icon-library"></span>
<span className="nav-text">{gettext('Info')}</span> <span className="nav-text">{gettext('Info')}</span>
</Link> </Link>