From 20c043a4c280891b3b1322a06887e6515a8d94fa Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 19 Dec 2016 14:54:24 -0800 Subject: Redirect to seed word screen for forgotten passwords. --- ui/app/first-time/init-menu.js | 16 ---------------- ui/app/keychains/hd/restore-vault.js | 8 ++++++-- ui/app/reducers/app.js | 3 ++- ui/app/unlock.js | 2 +- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js index c41aecc48..152d28809 100644 --- a/ui/app/first-time/init-menu.js +++ b/ui/app/first-time/init-menu.js @@ -21,7 +21,6 @@ function mapStateToProps (state) { // state from plugin currentView: state.appState.currentView, warning: state.appState.warning, - forgottenPassword: state.metamask.isInitialized, } } @@ -118,17 +117,6 @@ InitializeMenuScreen.prototype.renderMenu = function (state) { }, }, 'Create'), - state.forgottenPassword ? h('.flex-row.flex-center.flex-grow', [ - h('p.pointer', { - onClick: this.backToUnlockView.bind(this), - style: { - fontSize: '0.8em', - color: 'rgb(247, 134, 28)', - textDecoration: 'underline', - }, - }, 'Return to Login'), - ]) : null, - h('.flex-row.flex-center.flex-grow', [ h('p.pointer', { onClick: this.showRestoreVault.bind(this), @@ -159,10 +147,6 @@ InitializeMenuScreen.prototype.showRestoreVault = function () { this.props.dispatch(actions.showRestoreVault()) } -InitializeMenuScreen.prototype.backToUnlockView = function () { - this.props.dispatch(actions.backToUnlockView()) -} - InitializeMenuScreen.prototype.createNewVaultAndKeychain = function () { var passwordBox = document.getElementById('password-box') var password = passwordBox.value diff --git a/ui/app/keychains/hd/restore-vault.js b/ui/app/keychains/hd/restore-vault.js index 3fa25a2eb..06e51d9b3 100644 --- a/ui/app/keychains/hd/restore-vault.js +++ b/ui/app/keychains/hd/restore-vault.js @@ -14,6 +14,7 @@ function RestoreVaultScreen () { function mapStateToProps (state) { return { warning: state.appState.warning, + forgottenPassword: state.appState.forgottenPassword, } } @@ -100,14 +101,17 @@ RestoreVaultScreen.prototype.render = function () { }, 'OK'), ]), - ]) ) } RestoreVaultScreen.prototype.showInitializeMenu = function () { - this.props.dispatch(actions.showInitializeMenu()) + if (this.props.forgottenPassword) { + this.props.dispatch(actions.backToUnlockView()) + } else { + this.props.dispatch(actions.showInitializeMenu()) + } } RestoreVaultScreen.prototype.createOnEnter = function (event) { diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 67a926948..c69f0bae0 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -72,6 +72,7 @@ function reduceApp (state, action) { name: 'restoreVault', }, transForward: true, + forgottenPassword: true, }) case actions.SHOW_INIT_MENU: @@ -169,7 +170,7 @@ function reduceApp (state, action) { return extend(appState, { warning: null, transForward: true, - forgottenPassword: !appState.forgottenPassword, + forgottenPassword: false, currentView: { name: 'UnlockScreen', }, diff --git a/ui/app/unlock.js b/ui/app/unlock.js index 17416766d..d4603e9c3 100644 --- a/ui/app/unlock.js +++ b/ui/app/unlock.js @@ -70,7 +70,7 @@ UnlockScreen.prototype.render = function () { h('.flex-row.flex-center.flex-grow', [ h('p.pointer', { - onClick: () => this.props.dispatch(actions.goBackToInitView()), + onClick: () => this.props.dispatch(actions.showRestoreVault()), style: { fontSize: '0.8em', color: 'rgb(247, 134, 28)', -- cgit v1.2.3 From e9bea92ac3243e58321cd8cf3f44f0df0c66aa70 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 19 Dec 2016 14:55:52 -0800 Subject: Lint. --- app/scripts/keyring-controller.js | 3 +-- app/scripts/lib/idStore.js | 4 ++-- ui/app/actions.js | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 40c9695dd..ca4c306be 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -73,7 +73,7 @@ module.exports = class KeyringController extends EventEmitter { // or accept a state-resolving promise to consume their results. // // Not all methods end with this, that might be a nice refactor. - fullUpdate() { + fullUpdate () { this.emit('update') return Promise.resolve(this.getState()) } @@ -586,7 +586,6 @@ module.exports = class KeyringController extends EventEmitter { // Attempts to sign the provided @object msgParams. signMessage (msgParams, cb) { try { - const msgId = msgParams.metamaskId delete msgParams.metamaskId const approvalCb = this._unconfMsgCbs[msgId] || noop diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index d36504f13..cf4353e48 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -258,7 +258,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone function estimateGas (cb) { var estimationParams = extend(txParams) - query.getBlockByNumber('latest', true, function(err, block){ + query.getBlockByNumber('latest', true, function (err, block) { if (err) return cb(err) // check if gasLimit is already specified const gasLimitSpecified = Boolean(txParams.gas) @@ -267,7 +267,7 @@ IdentityStore.prototype.addUnconfirmedTransaction = function (txParams, onTxDone estimationParams.gas = block.gasLimit } // run tx, see if it will OOG - query.estimateGas(estimationParams, function(err, estimatedGasHex){ + query.estimateGas(estimationParams, function (err, estimatedGasHex) { if (err) return cb(err.message || err) // all gas used - must be an error if (estimatedGasHex === estimationParams.gas) { diff --git a/ui/app/actions.js b/ui/app/actions.js index 41be1004c..7c928a454 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -177,13 +177,13 @@ function tryUnlockMetamask (password) { } } -function transitionForward() { +function transitionForward () { return { type: this.TRANSITION_FORWARD, } } -function transitionBackward() { +function transitionBackward () { return { type: this.TRANSITION_BACKWARD, } -- cgit v1.2.3 From 92ddcba76bbfdddc440298e70cbff2229495aee5 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 19 Dec 2016 14:56:27 -0800 Subject: Add to changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c53879c96..fc4524a57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Current Master - Add support for synchronous RPC method "eth_uninstallFilter". +- Forgotten password prompts now send users directly to seed word restoration. ## 2.13.10 2016-11-22 -- cgit v1.2.3 From 9c8345467c871b29193263a13e8e8d3ebb47c7fb Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 19 Dec 2016 15:46:09 -0800 Subject: Modify actions to support better transition. --- ui/app/actions.js | 8 ++++++++ ui/app/reducers/app.js | 9 +++++++++ ui/app/unlock.js | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ui/app/actions.js b/ui/app/actions.js index 7c928a454..61f15b6cc 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -19,6 +19,8 @@ var actions = { CREATE_NEW_VAULT_IN_PROGRESS: 'CREATE_NEW_VAULT_IN_PROGRESS', SHOW_CREATE_VAULT: 'SHOW_CREATE_VAULT', SHOW_RESTORE_VAULT: 'SHOW_RESTORE_VAULT', + FORGOT_PASSWORD: 'FORGOT_PASSWORD', + forgotPassword: forgotPassword, SHOW_INIT_MENU: 'SHOW_INIT_MENU', SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED', SHOW_INFO_PAGE: 'SHOW_INFO_PAGE', @@ -380,6 +382,12 @@ function showRestoreVault () { } } +function forgotPassword () { + return { + type: actions.FORGOT_PASSWORD, + } +} + function showInitializeMenu () { return { type: actions.SHOW_INIT_MENU, diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index c69f0bae0..fb6767233 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -75,6 +75,15 @@ function reduceApp (state, action) { forgottenPassword: true, }) + case actions.FORGOT_PASSWORD: + return extend(appState, { + currentView: { + name: 'restoreVault', + }, + transForward: false, + forgottenPassword: true, + }) + case actions.SHOW_INIT_MENU: return extend(appState, { currentView: defaultView, diff --git a/ui/app/unlock.js b/ui/app/unlock.js index d4603e9c3..19f5eaec2 100644 --- a/ui/app/unlock.js +++ b/ui/app/unlock.js @@ -70,7 +70,7 @@ UnlockScreen.prototype.render = function () { h('.flex-row.flex-center.flex-grow', [ h('p.pointer', { - onClick: () => this.props.dispatch(actions.showRestoreVault()), + onClick: () => this.props.dispatch(actions.forgotPassword()), style: { fontSize: '0.8em', color: 'rgb(247, 134, 28)', -- cgit v1.2.3