1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
import EventEmitter from 'events'
import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux';
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
}
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, goToImportAccount, goToImportWithSeedPhrase } = this.props
return isLoading
? <LoadingScreen loadingMessage="Creating your new account" />
: (
<div>
<h2 className="alpha-warning">Warning This is Experemental software and is a Developer Alapha</h2>
<div className="first-view-main">
<div className="mascara-info">
<Mascot
animationEventEmitter={this.animationEventEmitter}
width="225"
height="225"
/>
<div className="info">
MetaMask is a bridge that allows you to visit the distributed web
of tomorrow in your browser today. It allows you to run Ethereum dApps right in
your browser without running a full Ethereum node but still gives
you the option to if you want to bring your own.
MetaMask includes a secure identity vault stored loacly on your machine,
providing a user interface to manage your identities on different sites
and sign blockchain transactions
</div>
</div>
<div className="create-password">
<div className="create-password__title">
Create Password
</div>
<input
className="first-time-flow__input"
type="password"
placeholder="New Password (min 8 characters)"
onChange={e => this.setState({password: e.target.value})}
/>
<input
className="first-time-flow__input create-password__confirm-input"
type="password"
placeholder="Confirm Password"
onChange={e => this.setState({confirmPassword: e.target.value})}
/>
<button
className="first-time-flow__button"
disabled={!this.isValid()}
onClick={this.createAccount}
>
Create
</button>
<a
href=""
className="first-time-flow__link create-password__import-link"
onClick={e => {
e.preventDefault()
goToImportWithSeedPhrase()
}}
>
Import with seed phrase
</a>
{ /* }
<a
href=""
className="first-time-flow__link create-password__import-link"
onClick={e => {
e.preventDefault()
goToImportAccount()
}}
>
Import an account
</a>
{ */ }
<Breadcrumbs total={3} currentIndex={0} />
</div>
</div>
</div>
)
}
}
export default connect(
({ appState: { isLoading } }) => ({ isLoading }),
dispatch => ({
createAccount: password => dispatch(createNewVaultAndKeychain(password)),
})
)(CreatePasswordScreen)
|