From 5251fb373f00d96b1a90bc9038a15e4d9ad98b85 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 23 Nov 2016 13:05:02 -0800 Subject: [PATCH 1/4] Modify forgot password flow to go back to init screen. --- ui/app/app.js | 34 ---------------------------------- ui/app/unlock.js | 3 +-- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/ui/app/app.js b/ui/app/app.js index 94e8adc34..9538a6b93 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -90,7 +90,6 @@ App.prototype.render = function () { transitionLeaveTimeout: 300, }, [ this.renderPrimary(), - this.renderBackToInitButton(), ]), ]), ]) @@ -337,39 +336,6 @@ App.prototype.renderBackButton = function (style, justArrow = false) { ) } -App.prototype.renderBackToInitButton = function () { - var props = this.props - var button = null - if (!props.isDisclaimerConfirmed) return button - - if (!props.isUnlocked) { - if (props.currentView.name === 'InitMenu') { - button = props.forgottenPassword ? h('.flex-row', { - key: 'rightArrow', - style: { - position: 'absolute', - bottom: '10px', - right: '15px', - fontSize: '21px', - fontFamily: 'Montserrat Light', - color: '#7F8082', - width: '77.578px', - alignItems: 'flex-end', - }, - }, [ - h('div.cursor-pointer', { - style: { - marginRight: '3px', - }, - onClick: () => props.dispatch(actions.backToUnlockView()), - }, 'LOGIN'), - h('i.fa.fa-arrow-right.cursor-pointer'), - ]) : null - } - } - return button -} - App.prototype.renderPrimary = function () { var props = this.props diff --git a/ui/app/unlock.js b/ui/app/unlock.js index ec467f483..17416766d 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.goBackToInitView()), style: { fontSize: '0.8em', color: 'rgb(247, 134, 28)', @@ -116,4 +116,3 @@ UnlockScreen.prototype.inputChanged = function (event) { y: boundingRect.top + coordinates.top - element.scrollTop, }) } - From 5a02e58f6287422a569f316fd4b2dd0144f50e99 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 23 Nov 2016 13:49:54 -0800 Subject: [PATCH 2/4] Fix proper behavior for restoring accounts when password forgotten. --- ui/app/actions.js | 1 + ui/app/reducers/app.js | 1 + 2 files changed, 2 insertions(+) diff --git a/ui/app/actions.js b/ui/app/actions.js index e78cf8a51..8f37b2e4c 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -197,6 +197,7 @@ function createNewVaultAndRestore (password, seed) { background.createNewVaultAndRestore(password, seed, (err) => { dispatch(actions.hideLoadingIndication()) if (err) return dispatch(actions.displayWarning(err.message)) + dispatch(actions.showAccountsPage()) }) } } diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 27d84d8a6..1f40e90b3 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -233,6 +233,7 @@ function reduceApp (state, action) { isLoading: false, warning: null, scrollToBottom: false, + forgottenPassword: false, }) case actions.REVEAL_ACCOUNT: From 3a503d2ac21ebb0d49e718527e7bcaddc6d6f322 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 23 Nov 2016 15:29:42 -0800 Subject: [PATCH 3/4] Add link back to unlock. --- ui/app/first-time/init-menu.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js index 6ceee6784..f9fb77aa5 100644 --- a/ui/app/first-time/init-menu.js +++ b/ui/app/first-time/init-menu.js @@ -21,6 +21,7 @@ function mapStateToProps (state) { // state from plugin currentView: state.appState.currentView, warning: state.appState.warning, + forgottenPassword: state.appState.forgottenPassword, } } @@ -128,6 +129,17 @@ InitializeMenuScreen.prototype.renderMenu = function (state) { }, 'I already have a DEN that I would like to import'), ]), + 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', + }, + }, 'I remember my password!'), + ]) : null, + ]) ) } @@ -147,6 +159,10 @@ 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 From 8dd298238de5de6b8c84bbefadd6db5c8af1adc6 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 23 Nov 2016 15:42:17 -0800 Subject: [PATCH 4/4] Cosmetic changes, rename links. --- ui/app/first-time/init-menu.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js index f9fb77aa5..c41aecc48 100644 --- a/ui/app/first-time/init-menu.js +++ b/ui/app/first-time/init-menu.js @@ -21,7 +21,7 @@ function mapStateToProps (state) { // state from plugin currentView: state.appState.currentView, warning: state.appState.warning, - forgottenPassword: state.appState.forgottenPassword, + forgottenPassword: state.metamask.isInitialized, } } @@ -118,27 +118,27 @@ InitializeMenuScreen.prototype.renderMenu = function (state) { }, }, 'Create'), - h('.flex-row.flex-center.flex-grow', [ + state.forgottenPassword ? h('.flex-row.flex-center.flex-grow', [ h('p.pointer', { - onClick: this.showRestoreVault.bind(this), + onClick: this.backToUnlockView.bind(this), style: { fontSize: '0.8em', color: 'rgb(247, 134, 28)', textDecoration: 'underline', }, - }, 'I already have a DEN that I would like to import'), - ]), + }, 'Return to Login'), + ]) : null, - state.forgottenPassword ? h('.flex-row.flex-center.flex-grow', [ + h('.flex-row.flex-center.flex-grow', [ h('p.pointer', { - onClick: this.backToUnlockView.bind(this), + onClick: this.showRestoreVault.bind(this), style: { fontSize: '0.8em', color: 'rgb(247, 134, 28)', textDecoration: 'underline', }, - }, 'I remember my password!'), - ]) : null, + }, 'Import Existing DEN'), + ]), ]) )