1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Using parsed seed phrase for restore vault input validation (#12229)

Fixes MetaMask/metamask-extension#12225
This commit is contained in:
ryanml 2021-09-28 12:21:19 -07:00 committed by GitHub
parent 3f577700c6
commit f52dac290b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,13 +44,14 @@ class RestoreVaultPage extends Component {
const { t } = this.context;
let seedPhraseError = null;
const wordCount = this.parseSeedPhrase(seedPhrase).split(/\s/u).length;
const parseSeedPhrase = this.parseSeedPhrase(seedPhrase);
const wordCount = parseSeedPhrase.split(/\s/u).length;
if (
seedPhrase &&
parseSeedPhrase &&
(wordCount % 3 !== 0 || wordCount < 12 || wordCount > 24)
) {
seedPhraseError = t('seedPhraseReq');
} else if (!isValidMnemonic(seedPhrase)) {
} else if (!isValidMnemonic(parseSeedPhrase)) {
seedPhraseError = t('invalidSeedPhrase');
}