diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 734378ca10..d865c785d8 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -26,6 +26,7 @@ var CompilerAbstract = require('../compiler/compiler-abstract') var tootip = require('../ui/tooltip') var confirmDialog = require('../execution/confirmDialog') +var modalCustom = require('../ui/modal-dialog-custom') function runTab (opts, localRegistry) { /* ------------------------- @@ -814,13 +815,23 @@ function settings (container, self) { }, 10000) function newAccount () { - self._deps.udapp.newAccount('', (error, address) => { - if (!error) { - addTooltip(`account ${address} created`) - } else { - addTooltip('Cannot create an account: ' + error) + self._deps.udapp.newAccount('', + (cb) => { + modalCustom.promptPassphraseCreation((error, passphrase) => { + if (error) { + return modalCustom.alert(error) + } + cb(passphrase) + }, () => {}) + }, + (error, address) => { + if (!error) { + addTooltip(`account ${address} created`) + } else { + addTooltip('Cannot create an account: ' + error) + } } - }) + ) } function signMessage (event) { self._deps.udapp.getAccounts((err, accounts) => { diff --git a/src/universal-dapp.js b/src/universal-dapp.js index bc6053482c..e917525514 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -75,18 +75,14 @@ UniversalDApp.prototype.createVMAccount = function (privateKey, balance, cb) { cb(null, '0x' + ethJSUtil.privateToAddress(privateKey).toString('hex')) } -UniversalDApp.prototype.newAccount = function (password, cb) { +UniversalDApp.prototype.newAccount = function (password, passwordPromptCb, cb) { if (!executionContext.isVM()) { if (!this._deps.config.get('settings/personal-mode')) { return cb('Not running in personal mode') } - modalCustom.promptPassphraseCreation((error, passphrase) => { - if (error) { - modalCustom.alert(error) - } else { - executionContext.web3().personal.newAccount(passphrase, cb) - } - }, () => {}) + passwordPromptCb((passphrase) => { + executionContext.web3().personal.newAccount(passphrase, cb) + }) } else { var privateKey do {