From e905c9f055cf9a5efbfa67a5371f2224934c49ab Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Fri, 10 Aug 2018 11:56:56 -0400 Subject: hide export private key for trezor accounts --- ui/app/components/modals/account-details-modal.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js index 5607cf051..049c75eee 100644 --- a/ui/app/components/modals/account-details-modal.js +++ b/ui/app/components/modals/account-details-modal.js @@ -14,6 +14,7 @@ function mapStateToProps (state) { return { network: state.metamask.network, selectedIdentity: getSelectedIdentity(state), + keyrings: state.metamask.keyrings, } } @@ -50,9 +51,20 @@ AccountDetailsModal.prototype.render = function () { network, showExportPrivateKeyModal, setAccountLabel, + keyrings, } = this.props const { name, address } = selectedIdentity + const keyring = keyrings.find((kr) => { + return kr.accounts.includes(address) + }) + + let exportPrivateKeyFeatureEnabled = true + if (keyring.type === 'Trezor Hardware') { + exportPrivateKeyFeatureEnabled = false + } + + return h(AccountModalContainer, {}, [ h(EditableLabel, { className: 'account-modal__name', @@ -73,9 +85,11 @@ AccountDetailsModal.prototype.render = function () { }, this.context.t('etherscanView')), // Holding on redesign for Export Private Key functionality - h('button.btn-primary.account-modal__button', { + // This feature is disabled for TREZOR accounts + + exportPrivateKeyFeatureEnabled ? h('button.btn-primary.account-modal__button', { onClick: () => showExportPrivateKeyModal(), - }, this.context.t('exportPrivateKey')), + }, this.context.t('exportPrivateKey')) : null, ]) } -- cgit v1.2.3 From eb2f4914588be3229ff96b0a471e37077a269b1b Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Fri, 10 Aug 2018 12:09:54 -0400 Subject: add error messages --- ui/app/components/pages/create-account/connect-hardware/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/pages/create-account/connect-hardware/index.js b/ui/app/components/pages/create-account/connect-hardware/index.js index 3f66e7098..6ad44e540 100644 --- a/ui/app/components/pages/create-account/connect-hardware/index.js +++ b/ui/app/components/pages/create-account/connect-hardware/index.js @@ -77,7 +77,7 @@ class ConnectHardwareForm extends Component { this.showTemporaryAlert() } - const newState = { unlocked: true } + const newState = { unlocked: true, error: null } // Default to the first account if (this.state.selectedAccount === null) { accounts.forEach((a, i) => { @@ -105,6 +105,8 @@ class ConnectHardwareForm extends Component { .catch(e => { if (e === 'Window blocked') { this.setState({ browserSupported: false }) + } else { + this.setState({ error: e.toString() }) } this.setState({ btnText: this.context.t('connectToTrezor') }) }) @@ -145,7 +147,7 @@ class ConnectHardwareForm extends Component { renderError () { return this.state.error - ? h('span.error', { style: { marginBottom: 40 } }, this.state.error) + ? h('span.error', { style: { margin: '20px 20px 10px', display: 'block', textAlign: 'center' } }, this.state.error) : null } -- cgit v1.2.3 From 0e1605b0829373d087d87c7be83046125ecd9e1f Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 20 Aug 2018 22:17:22 -0400 Subject: fix comment --- ui/app/components/modals/account-details-modal.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'ui/app/components') diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js index 38f70c33c..8e252787a 100644 --- a/ui/app/components/modals/account-details-modal.js +++ b/ui/app/components/modals/account-details-modal.js @@ -86,8 +86,6 @@ AccountDetailsModal.prototype.render = function () { }, this.context.t('etherscanView')), // Holding on redesign for Export Private Key functionality - // This feature is disabled for TREZOR accounts - exportPrivateKeyFeatureEnabled ? h('button.btn-primary.account-modal__button', { onClick: () => showExportPrivateKeyModal(), }, this.context.t('exportPrivateKey')) : null, -- cgit v1.2.3 From c0557b43e2c493de73c8bf74cfa9e5740c8cfd3f Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Thu, 15 Nov 2018 00:34:49 -0500 Subject: clean up --- ui/app/components/modals/account-details-modal.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app/components') diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js index d22230e32..248ffe008 100644 --- a/ui/app/components/modals/account-details-modal.js +++ b/ui/app/components/modals/account-details-modal.js @@ -67,7 +67,6 @@ AccountDetailsModal.prototype.render = function () { exportPrivateKeyFeatureEnabled = false } - return h(AccountModalContainer, {}, [ h(EditableLabel, { className: 'account-modal__name', -- cgit v1.2.3