aboutsummaryrefslogtreecommitdiffstats
path: root/mascara
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-08-07 12:37:16 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-08-07 12:39:26 +0800
commitd0611741a2ca0ef027238bc9022c728e973ce827 (patch)
tree38e51241d75ffda98398c0f2b601dccb3fd7d9a9 /mascara
parent7325ccf0feae0559645dce95e27197568c2b3533 (diff)
downloadtangerine-wallet-browser-d0611741a2ca0ef027238bc9022c728e973ce827.tar
tangerine-wallet-browser-d0611741a2ca0ef027238bc9022c728e973ce827.tar.gz
tangerine-wallet-browser-d0611741a2ca0ef027238bc9022c728e973ce827.tar.bz2
tangerine-wallet-browser-d0611741a2ca0ef027238bc9022c728e973ce827.tar.lz
tangerine-wallet-browser-d0611741a2ca0ef027238bc9022c728e973ce827.tar.xz
tangerine-wallet-browser-d0611741a2ca0ef027238bc9022c728e973ce827.tar.zst
tangerine-wallet-browser-d0611741a2ca0ef027238bc9022c728e973ce827.zip
Show invalid seed phrase error when importing new account
Diffstat (limited to 'mascara')
-rw-r--r--mascara/src/app/first-time/import-seed-phrase-screen.js9
1 files changed, 7 insertions, 2 deletions
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 })