mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Assure that seed words are placed into state tree upon request.
This commit is contained in:
parent
903d3aeb7a
commit
a95d96d507
@ -386,7 +386,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
.then((serialized) => {
|
.then((serialized) => {
|
||||||
const seedWords = serialized.mnemonic
|
const seedWords = serialized.mnemonic
|
||||||
this.configManager.setSeedWords(seedWords)
|
this.configManager.setSeedWords(seedWords)
|
||||||
cb()
|
cb(null, seedWords)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,8 +273,10 @@ function requestRevealSeed (password) {
|
|||||||
return dispatch(actions.displayWarning(err.message))
|
return dispatch(actions.displayWarning(err.message))
|
||||||
}
|
}
|
||||||
log.debug(`background.placeSeedWords`)
|
log.debug(`background.placeSeedWords`)
|
||||||
background.placeSeedWords((err) => {
|
background.placeSeedWords((err, result) => {
|
||||||
if (err) return dispatch(actions.displayWarning(err.message))
|
if (err) return dispatch(actions.displayWarning(err.message))
|
||||||
|
dispatch(actions.hideLoadingIndication())
|
||||||
|
dispatch(actions.showNewVaultSeed(result))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,8 @@ function mapStateToProps (state) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RevealSeedConfirmation.prototype.confirmationPhrase = 'I understand'
|
|
||||||
|
|
||||||
RevealSeedConfirmation.prototype.render = function () {
|
RevealSeedConfirmation.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const state = this.state
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
@ -64,31 +61,13 @@ RevealSeedConfirmation.prototype.render = function () {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
h(`h4${state && state.confirmationWrong ? '.error' : ''}`, {
|
|
||||||
style: {
|
|
||||||
marginTop: '12px',
|
|
||||||
},
|
|
||||||
}, `Enter the phrase "${this.confirmationPhrase}" to proceed.`),
|
|
||||||
|
|
||||||
// confirm confirmation
|
|
||||||
h('input.large-input.letter-spacey', {
|
|
||||||
type: 'text',
|
|
||||||
id: 'confirm-box',
|
|
||||||
placeholder: this.confirmationPhrase,
|
|
||||||
onKeyPress: this.checkConfirmation.bind(this),
|
|
||||||
style: {
|
|
||||||
width: 260,
|
|
||||||
marginTop: 16,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
|
|
||||||
h('.flex-row.flex-space-between', {
|
h('.flex-row.flex-space-between', {
|
||||||
style: {
|
style: {
|
||||||
marginTop: 30,
|
marginTop: 30,
|
||||||
width: '50%',
|
width: '50%',
|
||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
// cancel
|
// cancel
|
||||||
h('button.primary', {
|
h('button.primary', {
|
||||||
onClick: this.goHome.bind(this),
|
onClick: this.goHome.bind(this),
|
||||||
}, 'CANCEL'),
|
}, 'CANCEL'),
|
||||||
@ -134,15 +113,6 @@ RevealSeedConfirmation.prototype.checkConfirmation = function (event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RevealSeedConfirmation.prototype.revealSeedWords = function () {
|
RevealSeedConfirmation.prototype.revealSeedWords = function () {
|
||||||
this.setState({ confirmationWrong: false })
|
|
||||||
|
|
||||||
const confirmBox = document.getElementById('confirm-box')
|
|
||||||
const confirmation = confirmBox.value
|
|
||||||
if (confirmation !== this.confirmationPhrase) {
|
|
||||||
confirmBox.value = ''
|
|
||||||
return this.setState({ confirmationWrong: true })
|
|
||||||
}
|
|
||||||
|
|
||||||
var password = document.getElementById('password-box').value
|
var password = document.getElementById('password-box').value
|
||||||
this.props.dispatch(actions.requestRevealSeed(password))
|
this.props.dispatch(actions.requestRevealSeed(password))
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,7 @@ function reduceMetamask (state, action) {
|
|||||||
return extend(metamaskState, {
|
return extend(metamaskState, {
|
||||||
isUnlocked: true,
|
isUnlocked: true,
|
||||||
isInitialized: false,
|
isInitialized: false,
|
||||||
|
seedWords: action.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
case actions.CLEAR_SEED_WORD_CACHE:
|
case actions.CLEAR_SEED_WORD_CACHE:
|
||||||
|
Loading…
Reference in New Issue
Block a user