From 20c043a4c280891b3b1322a06887e6515a8d94fa Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 19 Dec 2016 14:54:24 -0800 Subject: [PATCH] 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)',