aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/keychains/hd/restore-vault.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/keychains/hd/restore-vault.js')
-rw-r--r--ui/app/keychains/hd/restore-vault.js32
1 files changed, 19 insertions, 13 deletions
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
}