mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
[NewUI] Opens to full screen when restoring from seed. (#3201)
* Opens to full screen when restoring from seed. * Remove redundant parameter in actions.markPasswordForgotten call.
This commit is contained in:
parent
9db0a32dac
commit
7f151b861c
@ -42,6 +42,17 @@ ConfigManager.prototype.getData = function () {
|
|||||||
return this.store.getState()
|
return this.store.getState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigManager.prototype.setPasswordForgotten = function (passwordForgottenState) {
|
||||||
|
const data = this.getData()
|
||||||
|
data.forgottenPassword = passwordForgottenState
|
||||||
|
this.setData(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigManager.prototype.getPasswordForgotten = function (passwordForgottenState) {
|
||||||
|
const data = this.getData()
|
||||||
|
return data.forgottenPassword
|
||||||
|
}
|
||||||
|
|
||||||
ConfigManager.prototype.setWallet = function (wallet) {
|
ConfigManager.prototype.setWallet = function (wallet) {
|
||||||
var data = this.getData()
|
var data = this.getData()
|
||||||
data.wallet = wallet
|
data.wallet = wallet
|
||||||
|
@ -315,6 +315,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
{
|
{
|
||||||
lostAccounts: this.configManager.getLostAccounts(),
|
lostAccounts: this.configManager.getLostAccounts(),
|
||||||
seedWords: this.configManager.getSeedWords(),
|
seedWords: this.configManager.getSeedWords(),
|
||||||
|
forgottenPassword: this.configManager.getPasswordForgotten(),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -337,6 +338,8 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
setCurrentCurrency: this.setCurrentCurrency.bind(this),
|
setCurrentCurrency: this.setCurrentCurrency.bind(this),
|
||||||
setUseBlockie: this.setUseBlockie.bind(this),
|
setUseBlockie: this.setUseBlockie.bind(this),
|
||||||
markAccountsFound: this.markAccountsFound.bind(this),
|
markAccountsFound: this.markAccountsFound.bind(this),
|
||||||
|
markPasswordForgotten: this.markPasswordForgotten.bind(this),
|
||||||
|
unMarkPasswordForgotten: this.unMarkPasswordForgotten.bind(this),
|
||||||
|
|
||||||
// coinbase
|
// coinbase
|
||||||
buyEth: this.buyEth.bind(this),
|
buyEth: this.buyEth.bind(this),
|
||||||
@ -791,6 +794,18 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
cb(null, this.getState())
|
cb(null, this.getState())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markPasswordForgotten(cb) {
|
||||||
|
this.configManager.setPasswordForgotten(true)
|
||||||
|
this.sendUpdate()
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
|
||||||
|
unMarkPasswordForgotten(cb) {
|
||||||
|
this.configManager.setPasswordForgotten(false)
|
||||||
|
this.sendUpdate()
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
|
||||||
restoreOldVaultAccounts (migratorOutput) {
|
restoreOldVaultAccounts (migratorOutput) {
|
||||||
const { serialized } = migratorOutput
|
const { serialized } = migratorOutput
|
||||||
return this.keyringController.restoreKeyring(serialized)
|
return this.keyringController.restoreKeyring(serialized)
|
||||||
|
@ -47,6 +47,8 @@ var actions = {
|
|||||||
SHOW_RESTORE_VAULT: 'SHOW_RESTORE_VAULT',
|
SHOW_RESTORE_VAULT: 'SHOW_RESTORE_VAULT',
|
||||||
FORGOT_PASSWORD: 'FORGOT_PASSWORD',
|
FORGOT_PASSWORD: 'FORGOT_PASSWORD',
|
||||||
forgotPassword: forgotPassword,
|
forgotPassword: forgotPassword,
|
||||||
|
markPasswordForgotten,
|
||||||
|
unMarkPasswordForgotten,
|
||||||
SHOW_INIT_MENU: 'SHOW_INIT_MENU',
|
SHOW_INIT_MENU: 'SHOW_INIT_MENU',
|
||||||
SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED',
|
SHOW_NEW_VAULT_SEED: 'SHOW_NEW_VAULT_SEED',
|
||||||
SHOW_INFO_PAGE: 'SHOW_INFO_PAGE',
|
SHOW_INFO_PAGE: 'SHOW_INFO_PAGE',
|
||||||
@ -819,6 +821,28 @@ function showRestoreVault () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function markPasswordForgotten () {
|
||||||
|
return (dispatch) => {
|
||||||
|
dispatch(actions.showLoadingIndication())
|
||||||
|
return background.markPasswordForgotten(() => {
|
||||||
|
dispatch(actions.hideLoadingIndication())
|
||||||
|
dispatch(actions.forgotPassword())
|
||||||
|
forceUpdateMetamaskState(dispatch)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function unMarkPasswordForgotten () {
|
||||||
|
return (dispatch) => {
|
||||||
|
dispatch(actions.showLoadingIndication())
|
||||||
|
return background.unMarkPasswordForgotten(() => {
|
||||||
|
dispatch(actions.hideLoadingIndication())
|
||||||
|
dispatch(actions.forgotPassword())
|
||||||
|
forceUpdateMetamaskState(dispatch)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function forgotPassword () {
|
function forgotPassword () {
|
||||||
return {
|
return {
|
||||||
type: actions.FORGOT_PASSWORD,
|
type: actions.FORGOT_PASSWORD,
|
||||||
|
@ -80,7 +80,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,
|
forgottenPassword: state.metamask.forgottenPassword,
|
||||||
lastUnreadNotice: state.metamask.lastUnreadNotice,
|
lastUnreadNotice: state.metamask.lastUnreadNotice,
|
||||||
lostAccounts: state.metamask.lostAccounts,
|
lostAccounts: state.metamask.lostAccounts,
|
||||||
frequentRpcList: state.metamask.frequentRpcList || [],
|
frequentRpcList: state.metamask.frequentRpcList || [],
|
||||||
@ -358,20 +358,12 @@ App.prototype.renderPrimary = function () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// show initialize screen
|
if (props.isInitialized && props.forgottenPassword) {
|
||||||
if (!props.isInitialized || props.forgottenPassword) {
|
log.debug('rendering restore vault screen')
|
||||||
// show current view
|
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
|
||||||
log.debug('rendering an initialize screen')
|
} else if (!props.isInitialized) {
|
||||||
switch (props.currentView.name) {
|
log.debug('rendering menu screen')
|
||||||
|
return h(InitializeMenuScreen, {key: 'menuScreenInit'})
|
||||||
case 'restoreVault':
|
|
||||||
log.debug('rendering restore vault screen')
|
|
||||||
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
|
|
||||||
|
|
||||||
default:
|
|
||||||
log.debug('rendering menu screen')
|
|
||||||
return h(InitializeMenuScreen, {key: 'menuScreenInit'})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// show unlock screen
|
// show unlock screen
|
||||||
|
@ -107,6 +107,7 @@ RestoreVaultScreen.prototype.render = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RestoreVaultScreen.prototype.showInitializeMenu = function () {
|
RestoreVaultScreen.prototype.showInitializeMenu = function () {
|
||||||
|
this.props.dispatch(actions.unMarkPasswordForgotten())
|
||||||
if (this.props.forgottenPassword) {
|
if (this.props.forgottenPassword) {
|
||||||
this.props.dispatch(actions.backToUnlockView())
|
this.props.dispatch(actions.backToUnlockView())
|
||||||
} else {
|
} else {
|
||||||
@ -149,6 +150,9 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () {
|
|||||||
this.warning = null
|
this.warning = null
|
||||||
this.props.dispatch(actions.displayWarning(this.warning))
|
this.props.dispatch(actions.displayWarning(this.warning))
|
||||||
this.props.dispatch(actions.createNewVaultAndRestore(password, seed))
|
this.props.dispatch(actions.createNewVaultAndRestore(password, seed))
|
||||||
|
.then(() => {
|
||||||
|
this.props.dispatch(actions.unMarkPasswordForgotten())
|
||||||
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
log.error(err.message)
|
log.error(err.message)
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,6 @@ const Component = require('react').Component
|
|||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
const inherits = require('util').inherits
|
const inherits = require('util').inherits
|
||||||
const AccountAndTransactionDetails = require('./account-and-transaction-details')
|
const AccountAndTransactionDetails = require('./account-and-transaction-details')
|
||||||
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
|
|
||||||
const Settings = require('./settings')
|
const Settings = require('./settings')
|
||||||
const UnlockScreen = require('./unlock')
|
const UnlockScreen = require('./unlock')
|
||||||
|
|
||||||
@ -28,13 +27,6 @@ MainContainer.prototype.render = function () {
|
|||||||
|
|
||||||
if (this.props.isUnlocked === false) {
|
if (this.props.isUnlocked === false) {
|
||||||
switch (this.props.currentViewName) {
|
switch (this.props.currentViewName) {
|
||||||
case 'restoreVault':
|
|
||||||
log.debug('rendering restore vault screen')
|
|
||||||
contents = {
|
|
||||||
component: HDRestoreVaultScreen,
|
|
||||||
key: 'HDRestoreVaultScreen',
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 'config':
|
case 'config':
|
||||||
log.debug('rendering config screen from unlock screen.')
|
log.debug('rendering config screen from unlock screen.')
|
||||||
return h(Settings, {key: 'config'})
|
return h(Settings, {key: 'config'})
|
||||||
|
@ -74,7 +74,10 @@ UnlockScreen.prototype.render = function () {
|
|||||||
|
|
||||||
h('.flex-row.flex-center.flex-grow', [
|
h('.flex-row.flex-center.flex-grow', [
|
||||||
h('p.pointer', {
|
h('p.pointer', {
|
||||||
onClick: () => this.props.dispatch(actions.forgotPassword()),
|
onClick: () => {
|
||||||
|
this.props.dispatch(actions.markPasswordForgotten())
|
||||||
|
global.platform.openExtensionInBrowser()
|
||||||
|
},
|
||||||
style: {
|
style: {
|
||||||
fontSize: '0.8em',
|
fontSize: '0.8em',
|
||||||
color: 'rgb(247, 134, 28)',
|
color: 'rgb(247, 134, 28)',
|
||||||
|
Loading…
Reference in New Issue
Block a user