Browse Source

handle ENTER key on login

all-modes
Petr Balashov 8 years ago
parent
commit
422e8fcb07
  1. 13
      react/src/components/login/login.js

13
react/src/components/login/login.js

@ -68,9 +68,8 @@ class Login extends React.Component {
this.setState({ this.setState({
display: false, display: false,
}); });
// Store.dispatch(stopInterval('activeCoins', this.props.Interval.interval));
} }
if (props && props.Main && !props.Main.isLoggedIn) { if (props && props.Main && !props.Main.isLoggedIn) {
this.setState({ this.setState({
display: true, display: true,
@ -85,6 +84,7 @@ class Login extends React.Component {
document.body.className = 'page-login layout-full page-dark'; document.body.className = 'page-login layout-full page-dark';
} }
if (this.state.activeLoginSection !== 'signup') { if (this.state.activeLoginSection !== 'signup') {
if (props && props.Main && props.Main.activeCoins) { if (props && props.Main && props.Main.activeCoins) {
this.setState({ this.setState({
@ -124,6 +124,7 @@ class Login extends React.Component {
this.setState({ this.setState({
isSeedConfirmError: false, isSeedConfirmError: false,
}); });
Store.dispatch(createNewWallet(this.state.randomSeedConfirm, this.props.Dashboard.activeHandle)); Store.dispatch(createNewWallet(this.state.randomSeedConfirm, this.props.Dashboard.activeHandle));
} else { } else {
this.setState({ this.setState({
@ -132,6 +133,12 @@ class Login extends React.Component {
} }
} }
handleKeydown(e) {
if (e.key === 'Enter') {
this.loginSeed();
}
}
render() { render() {
if ((this.state && this.state.display) || !this.props.Main) { if ((this.state && this.state.display) || !this.props.Main) {
return ( return (
@ -178,7 +185,7 @@ class Login extends React.Component {
<h4 style={{ color: '#fff' }} id="login-welcome">{translate('INDEX.WELCOME_LOGIN')}</h4> <h4 style={{ color: '#fff' }} id="login-welcome">{translate('INDEX.WELCOME_LOGIN')}</h4>
<div className="login-form"> <div className="login-form">
<div className="form-group form-material floating"> <div className="form-group form-material floating">
<input type={this.state.seedInputVisibility ? 'text' : 'password'} className="form-control" name="loginPassphrase" id="password" onChange={this.updateInput} /> <input type={this.state.seedInputVisibility ? 'text' : 'password'} className="form-control" name="loginPassphrase" id="password" onChange={this.updateInput} onKeyDown={(event) => this.handleKeydown(event)} />
<i className={this.state.seedInputVisibility ? 'seed-toggle fa fa-eye-slash' : 'seed-toggle fa fa-eye'} onClick={this.toggleSeedInputVisibility}></i> <i className={this.state.seedInputVisibility ? 'seed-toggle fa fa-eye-slash' : 'seed-toggle fa fa-eye'} onClick={this.toggleSeedInputVisibility}></i>
<label className="floating-label" htmlFor="inputPassword">{translate('INDEX.WALLET_SEED')}</label> <label className="floating-label" htmlFor="inputPassword">{translate('INDEX.WALLET_SEED')}</label>
</div> </div>

Loading…
Cancel
Save