From f503120b82c108efae0a4fc1282a43721d961ca2 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Fri, 20 Oct 2017 22:31:59 -0700 Subject: [PATCH] Add Import With Seed Phrase --- .../app/first-time/create-password-screen.js | 13 ++- .../first-time/import-seed-phrase-screen.js | 103 ++++++++++++++++++ mascara/src/app/first-time/index.css | 10 +- mascara/src/app/first-time/index.js | 11 +- ui/app/actions.js | 18 ++- yarn.lock | 20 ++-- 6 files changed, 156 insertions(+), 19 deletions(-) create mode 100644 mascara/src/app/first-time/import-seed-phrase-screen.js diff --git a/mascara/src/app/first-time/create-password-screen.js b/mascara/src/app/first-time/create-password-screen.js index a1816b88c..2f4b81e7c 100644 --- a/mascara/src/app/first-time/create-password-screen.js +++ b/mascara/src/app/first-time/create-password-screen.js @@ -8,6 +8,7 @@ class CreatePasswordScreen extends Component { static propTypes = { isLoading: PropTypes.bool.isRequired, createAccount: PropTypes.func.isRequired, + goToImportWithSeedPhrase: PropTypes.func.isRequired, goToImportAccount: PropTypes.func.isRequired, next: PropTypes.func.isRequired } @@ -44,7 +45,7 @@ class CreatePasswordScreen extends Component { } render() { - const { isLoading, goToImportAccount } = this.props + const { isLoading, goToImportAccount, goToImportWithSeedPhrase } = this.props return isLoading ? @@ -72,6 +73,16 @@ class CreatePasswordScreen extends Component { > Create + { + e.preventDefault() + goToImportWithSeedPhrase() + }} + > + Import with seed phrase + { /* } { + const { password, seedPhrase } = this.state + const { createNewVaultAndRestore, next } = this.props + + createNewVaultAndRestore(password, seedPhrase) + .then(next) + } + + isValid () { + const { seedPhrase, password, confirmPassword } = this.state + + if (seedPhrase.split(' ').length !== 12) { + return false + } + + if (password.length < 8) { + return false + } + + if (password !== confirmPassword) { + return false + } + + return true + } + + render () { + return this.props.isLoading + ? + : ( +
+ { + e.preventDefault() + this.props.back() + }} + href="#" + > + {`< Back`} + +
+ Import an Account with Seed Phrase +
+
+ Enter your secret twelve word phrase here to restore your vault. +
+