Skip to content

Commit

Permalink
Trim whitespace from seed phrase during import (#5827)
Browse files Browse the repository at this point in the history
  • Loading branch information
whymarrh authored Nov 26, 2018
1 parent eec7fce commit 33b85cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mascara/src/app/first-time/import-seed-phrase-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ImportSeedPhraseScreen extends Component {

parseSeedPhrase = (seedPhrase) => {
return seedPhrase
.trim()
.match(/\w+/g)
.join(' ')
}
Expand All @@ -41,9 +42,10 @@ class ImportSeedPhraseScreen extends Component {
let seedPhraseError = null

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')
}
}
Expand Down

0 comments on commit 33b85cf

Please sign in to comment.