mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #4960 from whymarrh/import-account-error
Show invalid seed phrase error when importing new account
This commit is contained in:
commit
564fb9f563
@ -510,6 +510,9 @@
|
|||||||
"invalidRPC": {
|
"invalidRPC": {
|
||||||
"message": "Invalid RPC URI"
|
"message": "Invalid RPC URI"
|
||||||
},
|
},
|
||||||
|
"invalidSeedPhrase": {
|
||||||
|
"message": "Invalid seed phrase"
|
||||||
|
},
|
||||||
"jsonFail": {
|
"jsonFail": {
|
||||||
"message": "Something went wrong. Please make sure your JSON file is properly formatted."
|
"message": "Something went wrong. Please make sure your JSON file is properly formatted."
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import {validateMnemonic} from 'bip39'
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
@ -39,8 +40,12 @@ class ImportSeedPhraseScreen extends Component {
|
|||||||
handleSeedPhraseChange (seedPhrase) {
|
handleSeedPhraseChange (seedPhrase) {
|
||||||
let seedPhraseError = null
|
let seedPhraseError = null
|
||||||
|
|
||||||
if (seedPhrase && this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) {
|
if (seedPhrase) {
|
||||||
seedPhraseError = this.context.t('seedPhraseReq')
|
if (this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) {
|
||||||
|
seedPhraseError = this.context.t('seedPhraseReq')
|
||||||
|
} else if (!validateMnemonic(seedPhrase)) {
|
||||||
|
seedPhraseError = this.context.t('invalidSeedPhrase')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ seedPhrase, seedPhraseError })
|
this.setState({ seedPhrase, seedPhraseError })
|
||||||
|
Loading…
Reference in New Issue
Block a user