aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-08-23 02:58:33 +0800
committerGitHub <noreply@github.com>2018-08-23 02:58:33 +0800
commitf495c0e9e03fff740bce5e94c0d14254c2c497e2 (patch)
tree836778d457baff880b2e3725e00fc4c2002b6902 /ui/app
parent171f6711d988cdfe04badee6f1b445a3abf513ad (diff)
parent743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e (diff)
downloadtangerine-wallet-browser-f495c0e9e03fff740bce5e94c0d14254c2c497e2.tar
tangerine-wallet-browser-f495c0e9e03fff740bce5e94c0d14254c2c497e2.tar.gz
tangerine-wallet-browser-f495c0e9e03fff740bce5e94c0d14254c2c497e2.tar.bz2
tangerine-wallet-browser-f495c0e9e03fff740bce5e94c0d14254c2c497e2.tar.lz
tangerine-wallet-browser-f495c0e9e03fff740bce5e94c0d14254c2c497e2.tar.xz
tangerine-wallet-browser-f495c0e9e03fff740bce5e94c0d14254c2c497e2.tar.zst
tangerine-wallet-browser-f495c0e9e03fff740bce5e94c0d14254c2c497e2.zip
Merge pull request #5102 from whymarrh/fix-account-export-pw-bug
Fix export privkey modal password bugs
Diffstat (limited to 'ui/app')
-rw-r--r--ui/app/components/modals/account-details-modal.js2
-rw-r--r--ui/app/components/modals/export-private-key-modal.js23
2 files changed, 20 insertions, 5 deletions
diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js
index cc90cf578..bc577fda0 100644
--- a/ui/app/components/modals/account-details-modal.js
+++ b/ui/app/components/modals/account-details-modal.js
@@ -61,7 +61,7 @@ AccountDetailsModal.prototype.render = function () {
let exportPrivateKeyFeatureEnabled = true
// This feature is disabled for hardware wallets
- if (keyring.type.search('Hardware') !== -1) {
+ if (keyring && keyring.type.search('Hardware') !== -1) {
exportPrivateKeyFeatureEnabled = false
}
diff --git a/ui/app/components/modals/export-private-key-modal.js b/ui/app/components/modals/export-private-key-modal.js
index 99b61bf9d..60a416304 100644
--- a/ui/app/components/modals/export-private-key-modal.js
+++ b/ui/app/components/modals/export-private-key-modal.js
@@ -1,3 +1,4 @@
+const log = require('loglevel')
const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript')
@@ -31,7 +32,13 @@ function mapStateToPropsFactory () {
function mapDispatchToProps (dispatch) {
return {
- exportAccount: (password, address) => dispatch(actions.exportAccount(password, address)),
+ exportAccount: (password, address) => {
+ return dispatch(actions.exportAccount(password, address))
+ .then((res) => {
+ dispatch(actions.hideWarning())
+ return res
+ })
+ },
showAccountDetailModal: () => dispatch(actions.showModal({ name: 'ACCOUNT_DETAILS' })),
hideModal: () => dispatch(actions.hideModal()),
}
@@ -44,6 +51,7 @@ function ExportPrivateKeyModal () {
this.state = {
password: '',
privateKey: null,
+ showWarning: true,
}
}
@@ -58,7 +66,11 @@ ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (passwo
const { exportAccount } = this.props
exportAccount(password, address)
- .then(privateKey => this.setState({ privateKey }))
+ .then(privateKey => this.setState({
+ privateKey,
+ showWarning: false,
+ }))
+ .catch((e) => log.error(e))
}
ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) {
@@ -118,7 +130,10 @@ ExportPrivateKeyModal.prototype.render = function () {
} = this.props
const { name, address } = selectedIdentity
- const { privateKey } = this.state
+ const {
+ privateKey,
+ showWarning,
+ } = this.state
return h(AccountModalContainer, {
selectedIdentity,
@@ -143,7 +158,7 @@ ExportPrivateKeyModal.prototype.render = function () {
this.renderPasswordInput(privateKey),
- !warning ? null : h('span.private-key-password-error', warning),
+ showWarning && warning ? h('span.private-key-password-error', warning) : null,
]),
h('div.private-key-password-warning', this.context.t('privateKeyWarning')),