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:
parent
3f577700c6
commit
f52dac290b
@ -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');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user