diff options
Diffstat (limited to 'ui/app/keychains/hd')
-rw-r--r-- | ui/app/keychains/hd/create-vault-complete.js | 2 | ||||
-rw-r--r-- | ui/app/keychains/hd/recover-seed/confirmation.js | 15 | ||||
-rw-r--r-- | ui/app/keychains/hd/restore-vault.js | 32 |
3 files changed, 30 insertions, 19 deletions
diff --git a/ui/app/keychains/hd/create-vault-complete.js b/ui/app/keychains/hd/create-vault-complete.js index 9d99eeb0d..5ab5d4c33 100644 --- a/ui/app/keychains/hd/create-vault-complete.js +++ b/ui/app/keychains/hd/create-vault-complete.js @@ -1,6 +1,6 @@ const inherits = require('util').inherits const Component = require('react').Component -const connect = require('../../metamask-connect') +const connect = require('react-redux').connect const h = require('react-hyperscript') const actions = require('../../actions') const exportAsFile = require('../../util').exportAsFile diff --git a/ui/app/keychains/hd/recover-seed/confirmation.js b/ui/app/keychains/hd/recover-seed/confirmation.js index f97ac66fe..02183f096 100644 --- a/ui/app/keychains/hd/recover-seed/confirmation.js +++ b/ui/app/keychains/hd/recover-seed/confirmation.js @@ -1,12 +1,17 @@ const inherits = require('util').inherits - const Component = require('react').Component -const connect = require('../../../metamask-connect') +const PropTypes = require('prop-types') +const connect = require('react-redux').connect const h = require('react-hyperscript') const actions = require('../../../actions') +RevealSeedConfirmation.contextTypes = { + t: PropTypes.func, +} + module.exports = connect(mapStateToProps)(RevealSeedConfirmation) + inherits(RevealSeedConfirmation, Component) function RevealSeedConfirmation () { Component.call(this) @@ -49,13 +54,13 @@ RevealSeedConfirmation.prototype.render = function () { }, }, [ - h('h4', this.props.t('revealSeedWordsWarning')), + h('h4', this.context.t('revealSeedWordsWarning')), // confirmation h('input.large-input.letter-spacey', { type: 'password', id: 'password-box', - placeholder: this.props.t('enterPasswordConfirm'), + placeholder: this.context.t('enterPasswordConfirm'), onKeyPress: this.checkConfirmation.bind(this), style: { width: 260, @@ -91,7 +96,7 @@ RevealSeedConfirmation.prototype.render = function () { ), props.inProgress && ( - h('span.in-progress-notification', this.props.t('generatingSeed')) + h('span.in-progress-notification', this.context.t('generatingSeed')) ), ]), ]) diff --git a/ui/app/keychains/hd/restore-vault.js b/ui/app/keychains/hd/restore-vault.js index f47a2641a..38ad14adb 100644 --- a/ui/app/keychains/hd/restore-vault.js +++ b/ui/app/keychains/hd/restore-vault.js @@ -1,11 +1,17 @@ const inherits = require('util').inherits +const PropTypes = require('prop-types') const PersistentForm = require('../../../lib/persistent-form') -const connect = require('../../metamask-connect') +const connect = require('react-redux').connect const h = require('react-hyperscript') const actions = require('../../actions') +RestoreVaultScreen.contextTypes = { + t: PropTypes.func, +} + module.exports = connect(mapStateToProps)(RestoreVaultScreen) + inherits(RestoreVaultScreen, PersistentForm) function RestoreVaultScreen () { PersistentForm.call(this) @@ -36,23 +42,23 @@ RestoreVaultScreen.prototype.render = function () { padding: 6, }, }, [ - this.props.t('restoreVault'), + this.context.t('restoreVault'), ]), // wallet seed entry - h('h3', this.props.t('walletSeed')), + h('h3', this.context.t('walletSeed')), h('textarea.twelve-word-phrase.letter-spacey', { dataset: { persistentFormId: 'wallet-seed', }, - placeholder: this.props.t('secretPhrase'), + placeholder: this.context.t('secretPhrase'), }), // password h('input.large-input.letter-spacey', { type: 'password', id: 'password-box', - placeholder: this.props.t('newPassword8Chars'), + placeholder: this.context.t('newPassword8Chars'), dataset: { persistentFormId: 'password', }, @@ -66,7 +72,7 @@ RestoreVaultScreen.prototype.render = function () { h('input.large-input.letter-spacey', { type: 'password', id: 'password-box-confirm', - placeholder: this.props.t('confirmPassword'), + placeholder: this.context.t('confirmPassword'), onKeyPress: this.createOnEnter.bind(this), dataset: { persistentFormId: 'password-confirmation', @@ -96,7 +102,7 @@ RestoreVaultScreen.prototype.render = function () { style: { textTransform: 'uppercase', }, - }, this.props.t('cancel')), + }, this.context.t('cancel')), // submit h('button.primary', { @@ -104,7 +110,7 @@ RestoreVaultScreen.prototype.render = function () { style: { textTransform: 'uppercase', }, - }, this.props.t('ok')), + }, this.context.t('ok')), ]), ]) ) @@ -135,13 +141,13 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () { var passwordConfirmBox = document.getElementById('password-box-confirm') var passwordConfirm = passwordConfirmBox.value if (password.length < 8) { - this.warning = this.props.t('passwordNotLongEnough') + this.warning = this.context.t('passwordNotLongEnough') this.props.dispatch(actions.displayWarning(this.warning)) return } if (password !== passwordConfirm) { - this.warning = this.props.t('passwordsDontMatch') + this.warning = this.context.t('passwordsDontMatch') this.props.dispatch(actions.displayWarning(this.warning)) return } @@ -151,18 +157,18 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () { // true if the string has more than a space between words. if (seed.split(' ').length > 1) { - this.warning = this.props.t('spaceBetween') + this.warning = this.context.t('spaceBetween') this.props.dispatch(actions.displayWarning(this.warning)) return } // true if seed contains a character that is not between a-z or a space if (!seed.match(/^[a-z ]+$/)) { - this.warning = this.props.t('loweCaseWords') + this.warning = this.context.t('loweCaseWords') this.props.dispatch(actions.displayWarning(this.warning)) return } if (seed.split(' ').length !== 12) { - this.warning = this.props.t('seedPhraseReq') + this.warning = this.context.t('seedPhraseReq') this.props.dispatch(actions.displayWarning(this.warning)) return } |