Commit 0edac160 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed missing enter handler on login dialog. Fixes 176.

parent 42ddd00b
Pipeline #52239 passed with stages
in 20 minutes and 5 seconds
...@@ -41,6 +41,7 @@ class LoginLogout extends React.Component { ...@@ -41,6 +41,7 @@ class LoginLogout extends React.Component {
super(props) super(props)
this.handleLogout = this.handleLogout.bind(this) this.handleLogout = this.handleLogout.bind(this)
this.handleChange = this.handleChange.bind(this) this.handleChange = this.handleChange.bind(this)
this.handleKeyPress = this.handleKeyPress.bind(this)
} }
state = { state = {
...@@ -82,7 +83,7 @@ class LoginLogout extends React.Component { ...@@ -82,7 +83,7 @@ class LoginLogout extends React.Component {
handleChange = name => event => { handleChange = name => event => {
this.setState({ this.setState({
[name]: event.target.value [name]: event.target.value, failure: false
}) })
} }
...@@ -93,6 +94,13 @@ class LoginLogout extends React.Component { ...@@ -93,6 +94,13 @@ class LoginLogout extends React.Component {
} }
} }
handleKeyPress(ev) {
if (ev.key === 'Enter') {
ev.preventDefault()
this.handleLoginDialogClosed(true)
}
}
render() { render() {
const { classes, user, variant, color, isLoggingIn } = this.props const { classes, user, variant, color, isLoggingIn } = this.props
const { failure } = this.state const { failure } = this.state
...@@ -141,6 +149,7 @@ class LoginLogout extends React.Component { ...@@ -141,6 +149,7 @@ class LoginLogout extends React.Component {
fullWidth fullWidth
value={this.state.userName} value={this.state.userName}
onChange={this.handleChange('userName')} onChange={this.handleChange('userName')}
onKeyPress={this.handleKeyPress}
/> />
<TextField <TextField
autoComplete="current-password" autoComplete="current-password"
...@@ -152,6 +161,7 @@ class LoginLogout extends React.Component { ...@@ -152,6 +161,7 @@ class LoginLogout extends React.Component {
fullWidth fullWidth
value={this.state.password} value={this.state.password}
onChange={this.handleChange('password')} onChange={this.handleChange('password')}
onKeyPress={this.handleKeyPress}
/> />
</FormGroup> </FormGroup>
</form> </form>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment