From f503120b82c108efae0a4fc1282a43721d961ca2 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Fri, 20 Oct 2017 22:31:59 -0700 Subject: Add Import With Seed Phrase --- .../app/first-time/import-seed-phrase-screen.js | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 mascara/src/app/first-time/import-seed-phrase-screen.js (limited to 'mascara/src/app/first-time/import-seed-phrase-screen.js') diff --git a/mascara/src/app/first-time/import-seed-phrase-screen.js b/mascara/src/app/first-time/import-seed-phrase-screen.js new file mode 100644 index 000000000..d2eed61b7 --- /dev/null +++ b/mascara/src/app/first-time/import-seed-phrase-screen.js @@ -0,0 +1,103 @@ +import React, {Component, PropTypes} from 'react' +import {connect} from 'react-redux' +import LoadingScreen from './loading-screen' +import {createNewVaultAndRestore, hideWarning} from '../../../../ui/app/actions' + +class ImportSeedPhraseScreen extends Component { + static propTypes = { + warning: PropTypes.string, + back: PropTypes.func.isRequired, + next: PropTypes.func.isRequired, + createNewVaultAndRestore: PropTypes.func.isRequired, + hideWarning: PropTypes.func.isRequired, + isLoading: PropTypes.bool.isRequired, + }; + + state = { + seedPhrase: '', + password: '', + confirmPassword: '', + } + + onClick = () => { + 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. +
+