mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add a back button on lock screen to go back to init menu
This commit is contained in:
parent
3756384da6
commit
483a7fee0a
@ -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)
|
||||||
|
@ -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(),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
@ -294,6 +296,61 @@ App.prototype.renderDropdown = function () {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App.prototype.renderBackToInitButton = function () {
|
||||||
|
var props = this.props
|
||||||
|
var button = null
|
||||||
|
var backButton = h('.flex-row', {
|
||||||
|
key: 'leftArrow',
|
||||||
|
transForward: false,
|
||||||
|
style: {
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: '10px',
|
||||||
|
left: '8px',
|
||||||
|
fontSize: '21px',
|
||||||
|
fontFamily: 'Montserrat Light',
|
||||||
|
color: '#7F8082',
|
||||||
|
width: '71.969px',
|
||||||
|
alignItems: 'flex-end',
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
h('i.fa.fa-arrow-left.cursor-pointer'),
|
||||||
|
h('div.cursor-pointer', {
|
||||||
|
style: {
|
||||||
|
marginLeft: '3px',
|
||||||
|
},
|
||||||
|
onClick: () => props.dispatch(actions.goBackToInitView()),
|
||||||
|
}, 'Back'),
|
||||||
|
])
|
||||||
|
if (!props.isUnlocked) {
|
||||||
|
if (props.currentView.name === 'InitMenu') {
|
||||||
|
button = props.forgottenPassword ? h('.flex-row', {
|
||||||
|
key: 'rightArrow',
|
||||||
|
style: {
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: '10px',
|
||||||
|
right: '8px',
|
||||||
|
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) {
|
||||||
|
button = backButton
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return button
|
||||||
|
}
|
||||||
|
|
||||||
App.prototype.renderPrimary = function () {
|
App.prototype.renderPrimary = function () {
|
||||||
var props = this.props
|
var props = this.props
|
||||||
|
|
||||||
@ -306,7 +363,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'),
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,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,
|
||||||
@ -136,6 +137,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:
|
||||||
@ -170,6 +190,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,
|
||||||
|
@ -25,47 +25,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, {
|
||||||
|
animationEventEmitter: this.animationEventEmitter,
|
||||||
|
}),
|
||||||
|
|
||||||
h(Mascot, {
|
h('h1', {
|
||||||
animationEventEmitter: this.animationEventEmitter,
|
style: {
|
||||||
}),
|
fontSize: '1.4em',
|
||||||
|
textTransform: 'uppercase',
|
||||||
|
color: '#7F8082',
|
||||||
|
},
|
||||||
|
}, 'MetaMask'),
|
||||||
|
|
||||||
h('h1', {
|
h('input.large-input', {
|
||||||
style: {
|
type: 'password',
|
||||||
fontSize: '1.4em',
|
id: 'password-box',
|
||||||
textTransform: 'uppercase',
|
placeholder: 'enter password',
|
||||||
color: '#7F8082',
|
style: {
|
||||||
},
|
|
||||||
}, 'MetaMask'),
|
|
||||||
|
|
||||||
h('input.large-input', {
|
},
|
||||||
type: 'password',
|
onKeyPress: this.onKeyPress.bind(this),
|
||||||
id: 'password-box',
|
onInput: this.inputChanged.bind(this),
|
||||||
placeholder: 'enter password',
|
}),
|
||||||
style: {
|
|
||||||
|
|
||||||
},
|
h('.error', {
|
||||||
onKeyPress: this.onKeyPress.bind(this),
|
style: {
|
||||||
onInput: this.inputChanged.bind(this),
|
display: warning ? 'block' : 'none',
|
||||||
}),
|
},
|
||||||
|
}, warning),
|
||||||
h('.error', {
|
|
||||||
style: {
|
|
||||||
display: warning ? 'block' : 'none',
|
|
||||||
},
|
|
||||||
}, warning),
|
|
||||||
|
|
||||||
h('button.primary.cursor-pointer', {
|
|
||||||
onClick: this.onSubmit.bind(this),
|
|
||||||
style: {
|
|
||||||
margin: 10,
|
|
||||||
},
|
|
||||||
}, 'Unlock'),
|
|
||||||
|
|
||||||
|
h('button.primary.cursor-pointer', {
|
||||||
|
onClick: this.onSubmit.bind(this),
|
||||||
|
style: {
|
||||||
|
margin: 10,
|
||||||
|
},
|
||||||
|
}, 'Unlock'),
|
||||||
|
]),
|
||||||
])
|
])
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user