Newer
Older
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
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: MIT
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import { Link } from 'react-router-dom';
@inject('createAccountStore')
@observer
class CreateAccountStep3 extends Component {
state = {
confirm: '',
hint: '',
password: ''
};
handleConfirmChange = ({ target: { value } }) => {
this.setState({ confirm: value });
};
handleHintChange = ({ target: { value } }) => {
this.setState({ hint: value });
};
handlePasswordChange = ({ target: { value } }) => {
this.setState({ password: value });
};
handleSubmit = () => {
const { createAccountStore, history } = this.props;
const { hint, password } = this.state;
createAccountStore.setPassword(password);
createAccountStore.setHint(hint);
history.push('/accounts/new/step5');
};
render() {
const { confirm, hint, password } = this.state;
return (
<div>
<h3>Create account step 4</h3>
<form onSubmit={this.handleSubmit}>
<label>
Password:{' '}
<input
onChange={this.handlePasswordChange}
required
type="password"
value={password}
/>
</label>
<br />
<label>
Confirm:{' '}
<input
onChange={this.handleConfirmChange}
required
type="password"
value={confirm}
/>
</label>
<br />
<label>
Password Hint (optional):{' '}
<input onChange={this.handleHintChange} value={hint} />
</label>
{password && confirm === password && <button>Submit</button>}
</form>
</div>
);
}
}
export default CreateAccountStep3;