diff options
author | Thomas Huang <tmashuang@users.noreply.github.com> | 2018-03-14 06:02:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-14 06:02:07 +0800 |
commit | 578139be4a048d1709de5c2b4b8db0a8c631d31c (patch) | |
tree | 841dc55e26f929edfa52b2299284cef3adc6ca0c | |
parent | 239d7106abe39b3a16871442b30edeac54b1bef4 (diff) | |
parent | a52ef7a06a04888d2de1246c0896f86f59a3f153 (diff) | |
download | tangerine-wallet-browser-578139be4a048d1709de5c2b4b8db0a8c631d31c.tar tangerine-wallet-browser-578139be4a048d1709de5c2b4b8db0a8c631d31c.tar.gz tangerine-wallet-browser-578139be4a048d1709de5c2b4b8db0a8c631d31c.tar.bz2 tangerine-wallet-browser-578139be4a048d1709de5c2b4b8db0a8c631d31c.tar.lz tangerine-wallet-browser-578139be4a048d1709de5c2b4b8db0a8c631d31c.tar.xz tangerine-wallet-browser-578139be4a048d1709de5c2b4b8db0a8c631d31c.tar.zst tangerine-wallet-browser-578139be4a048d1709de5c2b4b8db0a8c631d31c.zip |
Merge pull request #3546 from MetaMask/TheCriw-patch-1
improved verification of restore from seed phrase
-rw-r--r-- | old-ui/app/keychains/hd/restore-vault.js | 13 | ||||
-rw-r--r-- | ui/app/keychains/hd/restore-vault.js | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/old-ui/app/keychains/hd/restore-vault.js b/old-ui/app/keychains/hd/restore-vault.js index 222172dfd..ce39a1e7c 100644 --- a/old-ui/app/keychains/hd/restore-vault.js +++ b/old-ui/app/keychains/hd/restore-vault.js @@ -140,6 +140,19 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () { // check seed var seedBox = document.querySelector('textarea.twelve-word-phrase') var seed = seedBox.value.trim() + + // true if the string has more than a space between words. + if (seed.split(' ').length > 1) { + this.warning = 'there can only a space between words' + 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 = 'seed words only have lowercase characters' + this.props.dispatch(actions.displayWarning(this.warning)) + return + } if (seed.split(' ').length !== 12) { this.warning = 'seed phrases are 12 words long' this.props.dispatch(actions.displayWarning(this.warning)) diff --git a/ui/app/keychains/hd/restore-vault.js b/ui/app/keychains/hd/restore-vault.js index d1761f17d..685094854 100644 --- a/ui/app/keychains/hd/restore-vault.js +++ b/ui/app/keychains/hd/restore-vault.js @@ -144,6 +144,19 @@ RestoreVaultScreen.prototype.createNewVaultAndRestore = function () { // check seed var seedBox = document.querySelector('textarea.twelve-word-phrase') var seed = seedBox.value.trim() + + // true if the string has more than a space between words. + if (seed.split(' ').length > 1) { + this.warning = 'there can only a space between words' + 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 = 'seed words only have lowercase characters' + this.props.dispatch(actions.displayWarning(this.warning)) + return + } if (seed.split(' ').length !== 12) { this.warning = 'seed phrases are 12 words long' this.props.dispatch(actions.displayWarning(this.warning)) |