import EventEmitter from 'events' import React, { Component } from 'react' import PropTypes from 'prop-types' import {connect} from 'react-redux' import classnames from 'classnames' import {createNewVaultAndKeychain} from '../../../../ui/app/actions' import LoadingScreen from './loading-screen' import Breadcrumbs from './breadcrumbs' import Mascot from '../../../../ui/app/components/mascot' 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, isMascara: PropTypes.bool.isRequired, } state = { password: '', confirmPassword: '', } constructor () { super() this.animationEventEmitter = new EventEmitter() } isValid () { const {password, confirmPassword} = this.state if (!password || !confirmPassword) { return false } if (password.length < 8) { return false } return password === confirmPassword } createAccount = () => { if (!this.isValid()) { return } const {password} = this.state const {createAccount, next} = this.props createAccount(password) .then(next) } render () { const { isLoading, goToImportWithSeedPhrase, isMascara } = this.props return isLoading ? : (
{isMascara &&
MetaMask is a secure identity vault for Ethereum.
It allows you to hold ether & tokens, and interact with decentralized applications.
}
Create Password
this.setState({password: e.target.value})} /> this.setState({confirmPassword: e.target.value})} /> { e.preventDefault() goToImportWithSeedPhrase() }} > Import with seed phrase { /* } { e.preventDefault() goToImportAccount() }} > Import an account { */ }
) } } export default connect( ({ appState: { isLoading }, metamask: { isMascara } }) => ({ isLoading, isMascara }), dispatch => ({ createAccount: password => dispatch(createNewVaultAndKeychain(password)), }) )(CreatePasswordScreen)