Ask user to unlock their account #23

Merged
galfert merged 2 commits from feature/22-handle_locked_metamask into master 2017-06-14 20:15:18 +00:00
Showing only changes of commit b125d941ba - Show all commits
+14
View File
@@ -5,6 +5,20 @@ export default Ember.Route.extend({
kredits: Ember.inject.service(),
beforeModel(transition) {
const kredits = this.get('kredits');
if (kredits.get('web3') && kredits.get('web3Provided')) {
raucao commented 2017-06-14 05:21:06 +00:00 (Migrated from github.com)
Review

Wouldn't the second condition be enough here?

Wouldn't the second condition be enough here?
galfert commented 2017-06-14 10:02:42 +00:00 (Migrated from github.com)
Review

No, because the web3 property actually checks if there is a user provided web3 when called for the first time. And it's not being called before this, so we have to access it first.

No, because the `web3` property actually checks if there is a user provided web3 when called for the first time. And it's not being called before this, so we have to access it first.
kredits.get('web3').eth.getAccounts((error, accounts) => {
if (error || accounts.length === 0) {
if (confirm('Please unlock your accounts')) {
transition.retry();
}
}
});
}
},
model() {
let kredits = this.get('kredits');