Merge pull request #588 from MetaMask/i#563forgotPassword

Add a back button for Lock screen
feature/default_network_editable
Dan Finlay 8 years ago committed by GitHub
commit 9497d282c7
  1. 5
      CHANGELOG.md
  2. 5
      app/scripts/lib/idStore.js
  3. 1
      circle.yml
  4. 18
      ui/app/actions.js
  5. 90
      ui/app/app.js
  6. 2
      ui/app/first-time/init-menu.js
  7. 21
      ui/app/reducers/app.js
  8. 79
      ui/app/unlock.js

@ -2,6 +2,9 @@
## Current Master ## Current Master
- Add a back button and and functionality to unlock screen so
that you can recover your vault from seed or create a new one
if you forget your password.
- Changed transaction approval from notifications system to popup system. - Changed transaction approval from notifications system to popup system.
- Forms now retain their values even when closing the popup and reopening it. - Forms now retain their values even when closing the popup and reopening it.
@ -29,7 +32,7 @@
## 2.8.0 2016-08-15 ## 2.8.0 2016-08-15
- Integrate ShapeShift - Integrate ShapeShift
- Add a for for Coinbase to specify amount to buy - Add a form for Coinbase to specify amount to buy
- Fix various typos. - Fix various typos.
- Make dapp-metamask connection more reliable - Make dapp-metamask connection more reliable
- Remove Ethereum Classic from provider menu. - Remove Ethereum Classic from provider menu.

@ -45,7 +45,11 @@ function IdentityStore (opts = {}) {
IdentityStore.prototype.createNewVault = function (password, entropy, cb) { IdentityStore.prototype.createNewVault = function (password, entropy, cb) {
delete this._keyStore delete this._keyStore
var serializedKeystore = this.configManager.getWallet()
if (serializedKeystore) {
this.configManager.setData({})
}
this._createIdmgmt(password, null, entropy, (err) => { this._createIdmgmt(password, null, entropy, (err) => {
if (err) return cb(err) if (err) return cb(err)
@ -437,6 +441,7 @@ IdentityStore.prototype.tryPassword = function (password, cb) {
IdentityStore.prototype._createIdmgmt = function (password, seed, entropy, cb) { IdentityStore.prototype._createIdmgmt = function (password, seed, entropy, cb) {
const configManager = this.configManager const configManager = this.configManager
var keyStore = null var keyStore = null
LightwalletKeyStore.deriveKeyFromPassword(password, (err, derivedKey) => { LightwalletKeyStore.deriveKeyFromPassword(password, (err, derivedKey) => {
if (err) return cb(err) if (err) return cb(err)

@ -4,6 +4,7 @@ machine:
dependencies: dependencies:
pre: pre:
- "npm i -g testem" - "npm i -g testem"
- "npm i -g mocha"
override: override:
- sudo apt-get install libxss1 libappindicator1 libindicator7 lsb-base - sudo apt-get install libxss1 libappindicator1 libindicator7 lsb-base
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

@ -137,6 +137,12 @@ var actions = {
getQr: getQr, getQr: getQr,
reshowQrCode: reshowQrCode, reshowQrCode: reshowQrCode,
SHOW_QR_VIEW: 'SHOW_QR_VIEW', 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 module.exports = actions
@ -370,6 +376,12 @@ function showNewVaultSeed (seed) {
} }
} }
function backToUnlockView () {
return {
type: actions.BACK_TO_UNLOCK_VIEW,
}
}
// //
// unlock screen // unlock screen
// //
@ -498,6 +510,12 @@ function showConfigPage (transitionForward = true) {
} }
} }
function goBackToInitView () {
return {
type: actions.BACK_TO_INIT_MENU,
}
}
// //
// config // config
// //

@ -51,6 +51,7 @@ function mapStateToProps (state) {
menuOpen: state.appState.menuOpen, menuOpen: state.appState.menuOpen,
network: state.metamask.network, network: state.metamask.network,
provider: state.metamask.provider, provider: state.metamask.provider,
forgottenPassword: state.appState.forgottenPassword,
} }
} }
@ -89,6 +90,7 @@ App.prototype.render = function () {
transitionLeaveTimeout: 300, transitionLeaveTimeout: 300,
}, [ }, [
this.renderPrimary(), 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 () { App.prototype.renderPrimary = function () {
var props = this.props var props = this.props
@ -311,7 +399,7 @@ App.prototype.renderPrimary = function () {
} }
// show initialize screen // show initialize screen
if (!props.isInitialized) { if (!props.isInitialized || props.forgottenPassword) {
// show current view // show current view
switch (props.currentView.name) { switch (props.currentView.name) {

@ -73,9 +73,7 @@ InitializeMenuScreen.prototype.renderMenu = function () {
margin: 12, margin: 12,
}, },
}, 'Restore Existing Vault'), }, 'Restore Existing Vault'),
]) ])
) )
} }

@ -124,6 +124,7 @@ function reduceApp (state, action) {
case actions.UNLOCK_METAMASK: case actions.UNLOCK_METAMASK:
return extend(appState, { return extend(appState, {
forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null,
detailView: {}, detailView: {},
transForward: true, transForward: true,
isLoading: false, isLoading: false,
@ -137,6 +138,25 @@ function reduceApp (state, action) {
warning: null, 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 // reveal seed words
case actions.REVEAL_SEED_CONFIRMATION: case actions.REVEAL_SEED_CONFIRMATION:
@ -171,6 +191,7 @@ function reduceApp (state, action) {
case actions.SHOW_ACCOUNT_DETAIL: case actions.SHOW_ACCOUNT_DETAIL:
return extend(appState, { return extend(appState, {
forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null,
currentView: { currentView: {
name: 'accountDetail', name: 'accountDetail',
context: action.value, context: action.value,

@ -26,47 +26,46 @@ UnlockScreen.prototype.render = function () {
const state = this.props const state = this.props
const warning = state.warning const warning = state.warning
return ( return (
h('.flex-column.hey-im-here', [
h('.unlock-screen.flex-column.flex-center.flex-grow', [ h('.unlock-screen.flex-column.flex-center.flex-grow', [
h(Mascot, { h(Mascot, {
animationEventEmitter: this.animationEventEmitter, animationEventEmitter: this.animationEventEmitter,
}), }),
h('h1', { h('h1', {
style: { style: {
fontSize: '1.4em', fontSize: '1.4em',
textTransform: 'uppercase', textTransform: 'uppercase',
color: '#7F8082', color: '#7F8082',
}, },
}, 'MetaMask'), }, 'MetaMask'),
h('input.large-input', { h('input.large-input', {
type: 'password', type: 'password',
id: 'password-box', id: 'password-box',
placeholder: 'enter password', placeholder: 'enter password',
style: { style: {
}, },
onKeyPress: this.onKeyPress.bind(this), onKeyPress: this.onKeyPress.bind(this),
onInput: this.inputChanged.bind(this), onInput: this.inputChanged.bind(this),
}), }),
h('.error', { h('.error', {
style: { style: {
display: warning ? 'block' : 'none', display: warning ? 'block' : 'none',
}, },
}, warning), }, warning),
h('button.primary.cursor-pointer', { h('button.primary.cursor-pointer', {
onClick: this.onSubmit.bind(this), onClick: this.onSubmit.bind(this),
style: { style: {
margin: 10, margin: 10,
}, },
}, 'Unlock'), }, 'Unlock'),
]),
]) ])
) )
} }

Loading…
Cancel
Save