move passsword modal out of udapp logic

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent d4042d3d93
commit 17fcf93094
  1. 23
      src/app/tabs/run-tab.js
  2. 12
      src/universal-dapp.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) => {

@ -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 {

Loading…
Cancel
Save