1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Add recover and backup tempaltes

This commit is contained in:
Dan Finlay 2018-03-19 11:43:22 -07:00
parent 17371bb7ec
commit 2e7d4db2de
3 changed files with 42 additions and 18 deletions

View File

@ -83,6 +83,9 @@
"buyCoinbaseExplainer": { "buyCoinbaseExplainer": {
"message": "Coinbase is the worlds most popular way to buy and sell bitcoin, ethereum, and litecoin." "message": "Coinbase is the worlds most popular way to buy and sell bitcoin, ethereum, and litecoin."
}, },
"ok": {
message: "Ok"
},
"cancel": { "cancel": {
"message": "Cancel" "message": "Cancel"
}, },
@ -244,6 +247,12 @@
"enterPasswordConfirm": { "enterPasswordConfirm": {
"message": "Enter your password to confirm" "message": "Enter your password to confirm"
}, },
"passwordNotLongEnough": {
"message": "Password not long enough"
},
"passwordsDontMatch": {
"message": "Passwords Don't Match"
},
"etherscanView": { "etherscanView": {
"message": "View account on Etherscan" "message": "View account on Etherscan"
}, },
@ -583,12 +592,18 @@
"restoreFromSeed": { "restoreFromSeed": {
"message": "Restore from seed phrase" "message": "Restore from seed phrase"
}, },
"restoreVault": {
"message": "Restore Vault"
},
"required": { "required": {
"message": "Required" "message": "Required"
}, },
"retryWithMoreGas": { "retryWithMoreGas": {
"message": "Retry with a higher gas price here" "message": "Retry with a higher gas price here"
}, },
"walletSeed": {
"message": "Wallet Seed"
},
"revealSeedWords": { "revealSeedWords": {
"message": "Reveal Seed Words" "message": "Reveal Seed Words"
}, },
@ -639,6 +654,9 @@
"secretPhrase": { "secretPhrase": {
"message": "Enter your secret twelve word phrase here to restore your vault." "message": "Enter your secret twelve word phrase here to restore your vault."
}, },
"newPassword8Chars": {
"message": "New Password (min 8 chars)"
},
"seedPhraseReq": { "seedPhraseReq": {
"message": "seed phrases are 12 words long" "message": "seed phrases are 12 words long"
}, },

View File

@ -4,6 +4,7 @@ const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../../actions') const actions = require('../../../actions')
const t = require('../../../../i18n')
module.exports = connect(mapStateToProps)(RevealSeedConfirmation) module.exports = connect(mapStateToProps)(RevealSeedConfirmation)
@ -49,13 +50,13 @@ RevealSeedConfirmation.prototype.render = function () {
}, },
}, [ }, [
h('h4', 'Do not recover your seed words in a public place! These words can be used to steal all your accounts.'), h('h4', t('revealSeedWordsWarning')),
// confirmation // confirmation
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box', id: 'password-box',
placeholder: 'Enter your password to confirm', placeholder: t('enterPasswordConfirm'),
onKeyPress: this.checkConfirmation.bind(this), onKeyPress: this.checkConfirmation.bind(this),
style: { style: {
width: 260, width: 260,
@ -91,7 +92,7 @@ RevealSeedConfirmation.prototype.render = function () {
), ),
props.inProgress && ( props.inProgress && (
h('span.in-progress-notification', 'Generating Seed...') h('span.in-progress-notification', t('generatingSeed'))
), ),
]), ]),
]) ])

View File

@ -2,6 +2,7 @@ const inherits = require('util').inherits
const PersistentForm = require('../../../lib/persistent-form') const PersistentForm = require('../../../lib/persistent-form')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const t = require('../../../i18n')
const actions = require('../../actions') const actions = require('../../actions')
module.exports = connect(mapStateToProps)(RestoreVaultScreen) module.exports = connect(mapStateToProps)(RestoreVaultScreen)
@ -36,23 +37,23 @@ RestoreVaultScreen.prototype.render = function () {
padding: 6, padding: 6,
}, },
}, [ }, [
'Restore Vault', t('restoreVault'),
]), ]),
// wallet seed entry // wallet seed entry
h('h3', 'Wallet Seed'), h('h3', t('walletSeed')),
h('textarea.twelve-word-phrase.letter-spacey', { h('textarea.twelve-word-phrase.letter-spacey', {
dataset: { dataset: {
persistentFormId: 'wallet-seed', persistentFormId: 'wallet-seed',
}, },
placeholder: 'Enter your secret twelve word phrase here to restore your vault.', placeholder: t('secretPhrase'),
}), }),
// password // password
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box', id: 'password-box',
placeholder: 'New Password (min 8 chars)', placeholder: t('newPassword8Chars'),
dataset: { dataset: {
persistentFormId: 'password', persistentFormId: 'password',
}, },
@ -66,7 +67,7 @@ RestoreVaultScreen.prototype.render = function () {
h('input.large-input.letter-spacey', { h('input.large-input.letter-spacey', {
type: 'password', type: 'password',
id: 'password-box-confirm', id: 'password-box-confirm',
placeholder: 'Confirm Password', placeholder: t('confirmPassword'),
onKeyPress: this.createOnEnter.bind(this), onKeyPress: this.createOnEnter.bind(this),
dataset: { dataset: {
persistentFormId: 'password-confirmation', persistentFormId: 'password-confirmation',
@ -93,16 +94,20 @@ RestoreVaultScreen.prototype.render = function () {
// cancel // cancel
h('button.primary', { h('button.primary', {
onClick: this.showInitializeMenu.bind(this), onClick: this.showInitializeMenu.bind(this),
}, 'CANCEL'), style: {
textTransform: 'uppercase',
},
}, t('cancel')),
// submit // submit
h('button.primary', { h('button.primary', {
onClick: this.createNewVaultAndRestore.bind(this), onClick: this.createNewVaultAndRestore.bind(this),
}, 'OK'), style: {
textTransform: 'uppercase',
},
}, t('ok')),
]), ]),
]) ])
) )
} }
@ -131,13 +136,13 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () {
var passwordConfirmBox = document.getElementById('password-box-confirm') var passwordConfirmBox = document.getElementById('password-box-confirm')
var passwordConfirm = passwordConfirmBox.value var passwordConfirm = passwordConfirmBox.value
if (password.length < 8) { if (password.length < 8) {
this.warning = 'Password not long enough' this.warning = t('passwordNotLongEnough')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
if (password !== passwordConfirm) { if (password !== passwordConfirm) {
this.warning = 'Passwords don\'t match' this.warning = t('passwordsDontMatch')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
@ -147,18 +152,18 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () {
// true if the string has more than a space between words. // true if the string has more than a space between words.
if (seed.split(' ').length > 1) { if (seed.split(' ').length > 1) {
this.warning = 'there can only be a space between words' this.warning = t('spaceBetween')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
// true if seed contains a character that is not between a-z or a space // true if seed contains a character that is not between a-z or a space
if (!seed.match(/^[a-z ]+$/)) { if (!seed.match(/^[a-z ]+$/)) {
this.warning = 'seed words only have lowercase characters' this.warning = t('loweCaseWords')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }
if (seed.split(' ').length !== 12) { if (seed.split(' ').length !== 12) {
this.warning = 'seed phrases are 12 words long' this.warning = t('seedPhraseReq')
this.props.dispatch(actions.displayWarning(this.warning)) this.props.dispatch(actions.displayWarning(this.warning))
return return
} }