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 (#5827)
This commit is contained in:
parent
eec7fcebd5
commit
33b85cf2e4
@ -33,6 +33,7 @@ class ImportSeedPhraseScreen extends Component {
|
|||||||
|
|
||||||
parseSeedPhrase = (seedPhrase) => {
|
parseSeedPhrase = (seedPhrase) => {
|
||||||
return seedPhrase
|
return seedPhrase
|
||||||
|
.trim()
|
||||||
.match(/\w+/g)
|
.match(/\w+/g)
|
||||||
.join(' ')
|
.join(' ')
|
||||||
}
|
}
|
||||||
@ -41,9 +42,10 @@ class ImportSeedPhraseScreen extends Component {
|
|||||||
let seedPhraseError = null
|
let seedPhraseError = null
|
||||||
|
|
||||||
if (seedPhrase) {
|
if (seedPhrase) {
|
||||||
if (this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) {
|
const parsedSeedPhrase = this.parseSeedPhrase(seedPhrase)
|
||||||
|
if (parsedSeedPhrase.split(' ').length !== 12) {
|
||||||
seedPhraseError = this.context.t('seedPhraseReq')
|
seedPhraseError = this.context.t('seedPhraseReq')
|
||||||
} else if (!validateMnemonic(seedPhrase)) {
|
} else if (!validateMnemonic(parsedSeedPhrase)) {
|
||||||
seedPhraseError = this.context.t('invalidSeedPhrase')
|
seedPhraseError = this.context.t('invalidSeedPhrase')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user