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

Trim whitespace from seed phrase during import

Somehow we lost 33b85cf2e
This commit is contained in:
Whymarrh Whitby 2019-02-12 01:04:08 -03:30
parent 140fcb4bf1
commit f41830b798

View File

@ -30,6 +30,7 @@ export default class ImportWithSeedPhrase extends PureComponent {
parseSeedPhrase = (seedPhrase) => {
return seedPhrase
.trim()
.match(/\w+/g)
.join(' ')
}
@ -38,9 +39,10 @@ export default class ImportWithSeedPhrase extends PureComponent {
let seedPhraseError = ''
if (seedPhrase) {
if (this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) {
const parsedSeedPhrase = this.parseSeedPhrase(seedPhrase)
if (parsedSeedPhrase.split(' ').length !== 12) {
seedPhraseError = this.context.t('seedPhraseReq')
} else if (!validateMnemonic(seedPhrase)) {
} else if (!validateMnemonic(parsedSeedPhrase)) {
seedPhraseError = this.context.t('invalidSeedPhrase')
}
}