diff --git a/frontend/src/components/dialog/lib-decrypt-dialog.js b/frontend/src/components/dialog/lib-decrypt-dialog.js index 2d429291ba..0f82b5a9bd 100644 --- a/frontend/src/components/dialog/lib-decrypt-dialog.js +++ b/frontend/src/components/dialog/lib-decrypt-dialog.js @@ -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 {

{gettext('Wrong password')}

} - + + + + - -

{'* '}{gettext('The password will be kept in the server for only 1 hour.')}