2017-05-30 20:36:52 +00:00
|
|
|
import React, {Component} from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import {Field, reduxForm} from 'redux-form';
|
|
|
|
import GenerateWalletPasswordInputComponent from './GenerateWalletPasswordInputComponent';
|
|
|
|
import LedgerTrezorWarning from './LedgerTrezorWarning';
|
2017-05-31 03:34:57 +00:00
|
|
|
import translate from 'translations';
|
2017-04-18 23:01:25 +00:00
|
|
|
|
|
|
|
|
2017-04-25 00:00:58 +00:00
|
|
|
// VALIDATORS
|
|
|
|
const minLength = min => value => {
|
|
|
|
return value && value.length < min ? `Must be ${min} characters or more` : undefined
|
2017-05-31 03:34:57 +00:00
|
|
|
};
|
|
|
|
const minLength9 = minLength(9);
|
|
|
|
const required = value => value ? undefined : 'Required';
|
2017-04-18 23:01:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GenerateWalletPasswordComponent extends Component {
|
2017-04-14 01:27:28 +00:00
|
|
|
constructor(props) {
|
|
|
|
super(props)
|
|
|
|
}
|
|
|
|
|
|
|
|
static propTypes = {
|
2017-04-14 06:26:25 +00:00
|
|
|
title: PropTypes.string,
|
|
|
|
body: PropTypes.string,
|
|
|
|
userId: PropTypes.number,
|
2017-04-18 23:01:25 +00:00
|
|
|
id: PropTypes.number,
|
|
|
|
generateWalletPassword: PropTypes.object,
|
|
|
|
showPassword: PropTypes.bool,
|
|
|
|
showGenerateWalletPasswordAction: PropTypes.func,
|
|
|
|
generateWalletFileAction: PropTypes.func,
|
2017-04-27 06:15:27 +00:00
|
|
|
generateWalletHasDownloadedFileAction: PropTypes.func,
|
|
|
|
generateWalletFile: PropTypes.bool,
|
|
|
|
hasDownloadedWalletFile: PropTypes.bool,
|
|
|
|
generateWalletContinueToPaperAction: PropTypes.func,
|
|
|
|
canProceedToPaper: PropTypes.bool
|
2017-04-14 01:27:28 +00:00
|
|
|
};
|
|
|
|
|
2017-04-27 03:16:01 +00:00
|
|
|
|
|
|
|
continueToPaper() {
|
|
|
|
}
|
|
|
|
|
|
|
|
downloaded() {
|
2017-05-31 03:34:57 +00:00
|
|
|
let nextState = this.state;
|
|
|
|
nextState.hasDownloadedWalletFile = true;
|
2017-04-27 03:16:01 +00:00
|
|
|
this.setState(nextState)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-14 01:27:28 +00:00
|
|
|
render() {
|
2017-04-18 23:01:25 +00:00
|
|
|
const {
|
|
|
|
// handleSubmit,
|
|
|
|
// pristine,
|
|
|
|
// reset,
|
|
|
|
// submitting,
|
|
|
|
generateWalletPassword,
|
|
|
|
showPassword,
|
|
|
|
showGenerateWalletPasswordAction,
|
|
|
|
generateWalletFileAction,
|
2017-04-27 06:15:27 +00:00
|
|
|
generateWalletFile,
|
|
|
|
hasDownloadedWalletFile,
|
|
|
|
generateWalletHasDownloadedFileAction,
|
2017-05-30 20:36:52 +00:00
|
|
|
generateWalletContinueToPaperAction
|
|
|
|
// canProceedToPaper
|
2017-04-18 23:01:25 +00:00
|
|
|
|
|
|
|
} = this.props;
|
|
|
|
|
2017-04-14 01:27:28 +00:00
|
|
|
return (
|
|
|
|
<section className="container" style={{minHeight: '50%'}}>
|
|
|
|
<div className="tab-content">
|
|
|
|
<main className="tab-pane active text-center" role="main">
|
2017-04-27 03:16:01 +00:00
|
|
|
<br/>
|
|
|
|
{
|
2017-04-27 06:15:27 +00:00
|
|
|
!generateWalletFile && (
|
|
|
|
<div>
|
|
|
|
<section className="row">
|
2017-05-30 04:53:28 +00:00
|
|
|
<h1 aria-live="polite">{translate('NAV_GenerateWallet')}</h1>
|
2017-04-27 06:15:27 +00:00
|
|
|
<div className="col-sm-8 col-sm-offset-2">
|
2017-05-30 06:18:44 +00:00
|
|
|
<h4>{translate('HELP_1_Desc_3')}</h4>
|
2017-04-27 06:15:27 +00:00
|
|
|
<Field
|
|
|
|
validate={[required, minLength9]}
|
|
|
|
component={GenerateWalletPasswordInputComponent}
|
|
|
|
showPassword={showPassword}
|
|
|
|
showGenerateWalletPasswordAction={showGenerateWalletPasswordAction}
|
|
|
|
name="password"
|
|
|
|
type="text"/>
|
|
|
|
<br/>
|
|
|
|
<button onClick={() => generateWalletFileAction()}
|
|
|
|
disabled={generateWalletPassword ? generateWalletPassword.syncErrors : true}
|
|
|
|
className="btn btn-primary btn-block">
|
2017-05-30 06:18:44 +00:00
|
|
|
{translate('NAV_GenerateWallet')}
|
2017-04-27 06:15:27 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<LedgerTrezorWarning/>
|
|
|
|
</div>
|
2017-04-27 04:02:38 +00:00
|
|
|
)
|
2017-04-27 03:16:01 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
generateWalletFile && (
|
|
|
|
<section role="main" className="row">
|
2017-05-30 04:53:28 +00:00
|
|
|
<h1>{translate('GEN_Label_2')}</h1>
|
2017-04-27 03:16:01 +00:00
|
|
|
<br/>
|
|
|
|
<div className="col-sm-8 col-sm-offset-2">
|
|
|
|
<div aria-hidden="true" className="account-help-icon"><img
|
|
|
|
src="https://myetherwallet.com/images/icon-help.svg" className="help-icon"/>
|
2017-05-30 06:18:44 +00:00
|
|
|
<p className="account-help-text">{translate('x_KeystoreDesc')}</p>
|
|
|
|
<h4>{translate('x_Keystore2')}</h4>
|
2017-04-27 03:16:01 +00:00
|
|
|
</div>
|
|
|
|
<a role="button" className="btn btn-primary btn-block"
|
|
|
|
href="blob:https://myetherwallet.com/2455ae32-916f-4224-a806-414bbe680168"
|
|
|
|
download="UTC--2017-04-26T23-07-03.538Z--c5b7fff4e1669e38e8d6bc8fffe7e562b2b70f43"
|
|
|
|
aria-label="Download Keystore File (UTC / JSON · Recommended · Encrypted)"
|
|
|
|
aria-describedby="x_KeystoreDesc"
|
2017-05-30 06:18:44 +00:00
|
|
|
onClick={() => generateWalletHasDownloadedFileAction()}>{translate('x_Download')}</a>
|
|
|
|
<p className="sr-only" id="x_KeystoreDesc">{translate('x_KeystoreDesc')}</p>
|
2017-04-27 03:16:01 +00:00
|
|
|
<br/><br/><br/><br/>
|
|
|
|
</div>
|
|
|
|
<div className="col-xs-12 alert alert-danger">
|
|
|
|
<span>
|
|
|
|
MyEtherWallet.com is not a web wallet & does not store or transmit this secret information at any time. <br/>
|
|
|
|
<strong>If you do not save your wallet file and password, we cannot recover them.</strong><br/>
|
|
|
|
Save your wallet file now & back it up in a second location (not on your computer).
|
|
|
|
<br/><br/>
|
2017-04-27 04:02:38 +00:00
|
|
|
<a role="button"
|
2017-04-27 06:15:27 +00:00
|
|
|
className={`btn btn-info ${hasDownloadedWalletFile ? '' : 'disabled'}`}
|
|
|
|
onClick={() => generateWalletContinueToPaperAction()}> I understand. Continue. </a>
|
2017-04-27 03:16:01 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
)
|
|
|
|
}
|
2017-04-14 01:27:28 +00:00
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2017-04-18 23:01:25 +00:00
|
|
|
|
|
|
|
export default reduxForm({
|
|
|
|
form: 'generateWalletPassword' // a unique name for this form
|
2017-04-27 03:16:01 +00:00
|
|
|
})(GenerateWalletPasswordComponent);
|