aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Finlay <somniac@me.com>2016-08-27 02:52:43 +0800
committerGitHub <noreply@github.com>2016-08-27 02:52:43 +0800
commit9497d282c796a443ce329f302d6ec9a5290fa987 (patch)
treed7763ffba381fc6873021ad6423c3422e0b42ebf /ui
parent78f73038e789f4483f728a7cc9ea1c68b0b3d7fa (diff)
parentae3358666014e4c302284e7ef760ce0d24cd7094 (diff)
downloadtangerine-wallet-browser-9497d282c796a443ce329f302d6ec9a5290fa987.tar
tangerine-wallet-browser-9497d282c796a443ce329f302d6ec9a5290fa987.tar.gz
tangerine-wallet-browser-9497d282c796a443ce329f302d6ec9a5290fa987.tar.bz2
tangerine-wallet-browser-9497d282c796a443ce329f302d6ec9a5290fa987.tar.lz
tangerine-wallet-browser-9497d282c796a443ce329f302d6ec9a5290fa987.tar.xz
tangerine-wallet-browser-9497d282c796a443ce329f302d6ec9a5290fa987.tar.zst
tangerine-wallet-browser-9497d282c796a443ce329f302d6ec9a5290fa987.zip
Merge pull request #588 from MetaMask/i#563forgotPassword
Add a back button for Lock screen
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js18
-rw-r--r--ui/app/app.js90
-rw-r--r--ui/app/first-time/init-menu.js2
-rw-r--r--ui/app/reducers/app.js21
-rw-r--r--ui/app/unlock.js79
5 files changed, 167 insertions, 43 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index c6c932296..c92138f68 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -137,6 +137,12 @@ var actions = {
getQr: getQr,
reshowQrCode: reshowQrCode,
SHOW_QR_VIEW: 'SHOW_QR_VIEW',
+// FORGOT PASSWORD:
+ BACK_TO_INIT_MENU: 'BACK_TO_INIT_MENU',
+ goBackToInitView: goBackToInitView,
+ RECOVERY_IN_PROGRESS: 'RECOVERY_IN_PROGRESS',
+ BACK_TO_UNLOCK_VIEW: 'BACK_TO_UNLOCK_VIEW',
+ backToUnlockView: backToUnlockView,
}
module.exports = actions
@@ -370,6 +376,12 @@ function showNewVaultSeed (seed) {
}
}
+function backToUnlockView () {
+ return {
+ type: actions.BACK_TO_UNLOCK_VIEW,
+ }
+}
+
//
// unlock screen
//
@@ -498,6 +510,12 @@ function showConfigPage (transitionForward = true) {
}
}
+function goBackToInitView () {
+ return {
+ type: actions.BACK_TO_INIT_MENU,
+ }
+}
+
//
// config
//
diff --git a/ui/app/app.js b/ui/app/app.js
index 53ab7dd00..70a6fcd64 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -51,6 +51,7 @@ function mapStateToProps (state) {
menuOpen: state.appState.menuOpen,
network: state.metamask.network,
provider: state.metamask.provider,
+ forgottenPassword: state.appState.forgottenPassword,
}
}
@@ -89,6 +90,7 @@ App.prototype.render = function () {
transitionLeaveTimeout: 300,
}, [
this.renderPrimary(),
+ this.renderBackToInitButton(),
]),
]),
])
@@ -298,6 +300,92 @@ App.prototype.renderDropdown = function () {
}),
])
}
+App.prototype.renderBackButton = function (style, justArrow = false) {
+ var props = this.props
+ return (
+ h('.flex-row', {
+ key: 'leftArrow',
+ transForward: false,
+ style: style,
+ onClick: () => props.dispatch(actions.goBackToInitView()),
+ }, [
+ h('i.fa.fa-arrow-left.cursor-pointer'),
+ justArrow ? null : h('div.cursor-pointer', {
+ style: {
+ marginLeft: '3px',
+ },
+ onClick: () => props.dispatch(actions.goBackToInitView()),
+ }, 'BACK'),
+ ])
+ )
+
+}
+App.prototype.renderBackToInitButton = function () {
+ var props = this.props
+ var button = null
+ 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
+ } else if (props.isInitialized) {
+ var style
+ switch (props.currentView.name) {
+ case 'createVault':
+ style = {
+ position: 'absolute',
+ top: '41px',
+ left: '80px',
+ fontSize: '21px',
+ fontFamily: 'Montserrat Bold',
+ color: 'rgb(174, 174, 174)',
+ }
+ return this.renderBackButton(style, true)
+ case 'restoreVault':
+ style = {
+ position: 'absolute',
+ top: '41px',
+ left: '70px',
+ fontSize: '21px',
+ fontFamily: 'Montserrat Bold',
+ color: 'rgb(174, 174, 174)',
+ }
+ return this.renderBackButton(style, true)
+ default:
+ style = {
+ position: 'absolute',
+ bottom: '10px',
+ left: '15px',
+ fontSize: '21px',
+ fontFamily: 'Montserrat Light',
+ color: '#7F8082',
+ width: '71.969px',
+ alignItems: 'flex-end',
+ }
+ return this.renderBackButton(style)
+ }
+ }
+ }
+ return button
+}
App.prototype.renderPrimary = function () {
var props = this.props
@@ -311,7 +399,7 @@ App.prototype.renderPrimary = function () {
}
// show initialize screen
- if (!props.isInitialized) {
+ if (!props.isInitialized || props.forgottenPassword) {
// show current view
switch (props.currentView.name) {
diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js
index e63c30fc5..94a9d3df6 100644
--- a/ui/app/first-time/init-menu.js
+++ b/ui/app/first-time/init-menu.js
@@ -73,9 +73,7 @@ InitializeMenuScreen.prototype.renderMenu = function () {
margin: 12,
},
}, 'Restore Existing Vault'),
-
])
-
)
}
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index da2c6e371..bad11113a 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -124,6 +124,7 @@ function reduceApp (state, action) {
case actions.UNLOCK_METAMASK:
return extend(appState, {
+ forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null,
detailView: {},
transForward: true,
isLoading: false,
@@ -137,6 +138,25 @@ function reduceApp (state, action) {
warning: null,
})
+ case actions.BACK_TO_INIT_MENU:
+ return extend(appState, {
+ warning: null,
+ transForward: false,
+ forgottenPassword: true,
+ currentView: {
+ name: 'InitMenu',
+ },
+ })
+
+ case actions.BACK_TO_UNLOCK_VIEW:
+ return extend(appState, {
+ warning: null,
+ transForward: true,
+ forgottenPassword: !appState.forgottenPassword,
+ currentView: {
+ name: 'UnlockScreen',
+ },
+ })
// reveal seed words
case actions.REVEAL_SEED_CONFIRMATION:
@@ -171,6 +191,7 @@ function reduceApp (state, action) {
case actions.SHOW_ACCOUNT_DETAIL:
return extend(appState, {
+ forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null,
currentView: {
name: 'accountDetail',
context: action.value,
diff --git a/ui/app/unlock.js b/ui/app/unlock.js
index 7cc1699c3..b82e46d02 100644
--- a/ui/app/unlock.js
+++ b/ui/app/unlock.js
@@ -26,47 +26,46 @@ UnlockScreen.prototype.render = function () {
const state = this.props
const warning = state.warning
return (
-
- h('.unlock-screen.flex-column.flex-center.flex-grow', [
-
- h(Mascot, {
- animationEventEmitter: this.animationEventEmitter,
- }),
-
- h('h1', {
- style: {
- fontSize: '1.4em',
- textTransform: 'uppercase',
- color: '#7F8082',
- },
- }, 'MetaMask'),
-
- h('input.large-input', {
- type: 'password',
- id: 'password-box',
- placeholder: 'enter password',
- style: {
-
- },
- onKeyPress: this.onKeyPress.bind(this),
- onInput: this.inputChanged.bind(this),
- }),
-
- h('.error', {
- style: {
- display: warning ? 'block' : 'none',
- },
- }, warning),
-
- h('button.primary.cursor-pointer', {
- onClick: this.onSubmit.bind(this),
- style: {
- margin: 10,
- },
- }, 'Unlock'),
-
+ h('.flex-column.hey-im-here', [
+ h('.unlock-screen.flex-column.flex-center.flex-grow', [
+
+ h(Mascot, {
+ animationEventEmitter: this.animationEventEmitter,
+ }),
+
+ h('h1', {
+ style: {
+ fontSize: '1.4em',
+ textTransform: 'uppercase',
+ color: '#7F8082',
+ },
+ }, 'MetaMask'),
+
+ h('input.large-input', {
+ type: 'password',
+ id: 'password-box',
+ placeholder: 'enter password',
+ style: {
+
+ },
+ onKeyPress: this.onKeyPress.bind(this),
+ onInput: this.inputChanged.bind(this),
+ }),
+
+ h('.error', {
+ style: {
+ display: warning ? 'block' : 'none',
+ },
+ }, warning),
+
+ h('button.primary.cursor-pointer', {
+ onClick: this.onSubmit.bind(this),
+ style: {
+ margin: 10,
+ },
+ }, 'Unlock'),
+ ]),
])
-
)
}