diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-08-07 13:07:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 13:07:14 +0800 |
commit | 564fb9f56357910dc658c3c45b35688958ed262c (patch) | |
tree | 38e51241d75ffda98398c0f2b601dccb3fd7d9a9 | |
parent | 7325ccf0feae0559645dce95e27197568c2b3533 (diff) | |
parent | d0611741a2ca0ef027238bc9022c728e973ce827 (diff) | |
download | tangerine-wallet-browser-564fb9f56357910dc658c3c45b35688958ed262c.tar tangerine-wallet-browser-564fb9f56357910dc658c3c45b35688958ed262c.tar.gz tangerine-wallet-browser-564fb9f56357910dc658c3c45b35688958ed262c.tar.bz2 tangerine-wallet-browser-564fb9f56357910dc658c3c45b35688958ed262c.tar.lz tangerine-wallet-browser-564fb9f56357910dc658c3c45b35688958ed262c.tar.xz tangerine-wallet-browser-564fb9f56357910dc658c3c45b35688958ed262c.tar.zst tangerine-wallet-browser-564fb9f56357910dc658c3c45b35688958ed262c.zip |
Merge pull request #4960 from whymarrh/import-account-error
Show invalid seed phrase error when importing new account
-rw-r--r-- | app/_locales/en/messages.json | 3 | ||||
-rw-r--r-- | mascara/src/app/first-time/import-seed-phrase-screen.js | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 8d65bc596..1b0183c92 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -510,6 +510,9 @@ "invalidRPC": { "message": "Invalid RPC URI" }, + "invalidSeedPhrase": { + "message": "Invalid seed phrase" + }, "jsonFail": { "message": "Something went wrong. Please make sure your JSON file is properly formatted." }, diff --git a/mascara/src/app/first-time/import-seed-phrase-screen.js b/mascara/src/app/first-time/import-seed-phrase-screen.js index fd2516ad4..883893e88 100644 --- a/mascara/src/app/first-time/import-seed-phrase-screen.js +++ b/mascara/src/app/first-time/import-seed-phrase-screen.js @@ -1,3 +1,4 @@ +import {validateMnemonic} from 'bip39' import React, { Component } from 'react' import PropTypes from 'prop-types' import {connect} from 'react-redux' @@ -39,8 +40,12 @@ class ImportSeedPhraseScreen extends Component { handleSeedPhraseChange (seedPhrase) { let seedPhraseError = null - if (seedPhrase && this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) { - seedPhraseError = this.context.t('seedPhraseReq') + if (seedPhrase) { + 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 }) |