diff options
author | elijah <elijah@riseup.net> | 2016-11-08 13:55:08 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2016-11-08 13:55:08 -0800 |
commit | 9d845e98a2a5cda8aaa22f581e28506a627dca43 (patch) | |
tree | 0f4807a7b76a4218c3c86420969a6f993428d715 /ui | |
parent | 395612dffea06b52153b7a6acf22ab33207c9346 (diff) |
ui: auto-initialize provider when logging in from the greeter
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/greeter_panel.js | 5 | ||||
-rw-r--r-- | ui/app/components/login.js | 3 | ||||
-rw-r--r-- | ui/app/models/account.js | 8 |
3 files changed, 10 insertions, 6 deletions
diff --git a/ui/app/components/greeter_panel.js b/ui/app/components/greeter_panel.js index c95b183a..acaf0d57 100644 --- a/ui/app/components/greeter_panel.js +++ b/ui/app/components/greeter_panel.js @@ -17,7 +17,7 @@ export default class GreeterPanel extends React.Component { } onLogin(account) { - App.show('main', {initialAccount: account}) + App.start() } render () { @@ -25,7 +25,8 @@ export default class GreeterPanel extends React.Component { <Splash speed="slow" mask={false} /> <Center width="400"> <Area position="top" type="light" className="greeter"> - <Login onLogin={this.onLogin.bind(this)} rememberAllowed={false}/> + <Login onLogin={this.onLogin.bind(this)} + rememberAllowed={false} autoAllowed={true} /> </Area> <Area position="bottom" type="dark" className="greeter"> <Glyphicon glyph="user" /> diff --git a/ui/app/components/login.js b/ui/app/components/login.js index 9ff6541e..0a47d58c 100644 --- a/ui/app/components/login.js +++ b/ui/app/components/login.js @@ -14,6 +14,7 @@ class Login extends React.Component { static get defaultProps() {return{ rememberAllowed: false, // if set, show remember password checkbox + autoAllowed: false, // if set, allow auto setup of provider domain: null, // if set, only allow this domain address: null, // if set, only allow this username@domain onLogin: null, // callback @@ -391,7 +392,7 @@ class Login extends React.Component { doLogin() { let account = Account.findOrAdd(this.state.username) - account.login(this.state.password).then( + account.login(this.state.password, this.props.autoAllowed).then( account => { this.setState({loading: false}) if (this.props.onLogin) { diff --git a/ui/app/models/account.js b/ui/app/models/account.js index cb008cc0..e93d7572 100644 --- a/ui/app/models/account.js +++ b/ui/app/models/account.js @@ -53,8 +53,8 @@ export default class Account { // // returns a promise, fulfill is passed account object // - login(password) { - return bitmask.bonafide.user.auth(this.address, password).then( + login(password, autoSetupProvider=false) { + return bitmask.bonafide.user.auth(this.address, password, autoSetupProvider).then( response => { if (response.uuid) { this._uuid = response.uuid @@ -145,7 +145,9 @@ export default class Account { Account.list = Account.list.filter(i => { return i.id != account.id }) - if (index >= Account.list.length) { + if (Account.list.length == 0) { + return null + } else if (index >= Account.list.length) { index = index - 1 } else if (index == -1) { index = 0 |