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

fix decrypt dialog (#2673)

This commit is contained in:
C_Q
2018-12-20 13:57:53 +08:00
committed by Daniel Pan
parent 3bbb44602b
commit 4c88f5a2bb

View File

@@ -15,7 +15,7 @@ class LibDecryptDialog extends React.Component {
};
}
handleSubmit = () => {
handleSubmit = (e) => {
let repoID = this.props.repoID;
let password = this.state.password;
seafileAPI.setRepoDecryptPassword(repoID, password).then(res => {
@@ -25,8 +25,15 @@ class LibDecryptDialog extends React.Component {
showError: true
});
})
e.preventDefault();
}
handleKeyPress = (e) => {
if (e.key == 'Enter') {
this.handleSubmit(e);
}
};
handleChange = (e) => {
this.setState({
password: e.target.value,
@@ -50,10 +57,11 @@ class LibDecryptDialog extends React.Component {
<p className="error">{gettext('Wrong password')}</p>
}
<FormGroup>
<Input type="password" name="password" placeholder={gettext('Password')} onChange={this.handleChange}/>
<Input type="password" name="password" onKeyPress={this.handleKeyPress} placeholder={gettext('Password')} onChange={this.handleChange}/>
</FormGroup>
<FormGroup>
<Button type="submit" value="Submit" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
</FormGroup>
<Button onClick={this.handleSubmit}>{gettext('Submit')}</Button>
<br />
<p className="tip">{'* '}{gettext('The password will be kept in the server for only 1 hour.')}</p>
</Form>
</ModalBody>