@@ -11,50 +11,27 @@ type Props = {
11
11
setAccountFromMnemonic : SetAccountFromMnemonic
12
12
} ;
13
13
14
- // FIXME: this has no error handling, neither while parsing the address
15
- // nor when fetching the balance.
16
14
export default ( { setAccountFromMnemonic } : Props ) => {
17
15
const checkIsValidMnemonicPhrase = function checkIsValidMnemonicPhrase ( ) {
18
16
setIsMnemonicValid ( isValidMnemonic ( newMnemonicPhrase ) ) ;
19
17
} ;
20
18
21
19
const handleSubmitMnemonic = function handleSubmitMnemonic ( event ) {
22
20
event . preventDefault ( ) ;
23
- if ( mustCreateSpendingPassword ) {
24
- if (
25
- isValidMnemonic ( newMnemonicPhrase ) &&
26
- checkValidSpendingPassword ( password , confirmPassword )
27
- ) {
28
- return Promise . all ( [
29
- setAccountFromMnemonic (
30
- newMnemonicPhrase ,
31
- newMnemonicPassword ,
32
- password
33
- )
34
- ] ) ;
35
- }
36
- }
37
21
if ( isValidMnemonic ( newMnemonicPhrase ) ) {
38
- return Promise . all ( [
39
- setAccountFromMnemonic ( newMnemonicPhrase , newMnemonicPassword , '' )
40
- ] ) ;
22
+ if ( checkValidSpendingPassword ( password , confirmPassword ) ) {
23
+ return setAccountFromMnemonic (
24
+ newMnemonicPhrase ,
25
+ newMnemonicPassword ,
26
+ password
27
+ ) ;
28
+ }
29
+ } else {
30
+ setIsMnemonicValid ( false ) ;
41
31
}
42
-
43
- setIsMnemonicValid ( false ) ;
44
- } ;
45
-
46
- const handleCheckCreateSpendingPassword = function handleCheckCreateSpendingPassword (
47
- evt
48
- ) {
49
- setMustCreateSpendingPassword ( evt . target . checked ) ;
50
- setHiddenSpendingPassword ( ! evt . target . checked ) ;
51
32
} ;
52
33
53
34
const [ isMnemonicValid , setIsMnemonicValid ] = useState ( true ) ;
54
- const [ hiddenSpendingPassword , setHiddenSpendingPassword ] = useState ( false ) ;
55
- const [ mustCreateSpendingPassword , setMustCreateSpendingPassword ] = useState (
56
- true
57
- ) ;
58
35
59
36
const [ newMnemonicPhrase , setNewMnemonicPhrase ] = useState ( '' ) ;
60
37
@@ -118,21 +95,17 @@ export default ({ setAccountFromMnemonic }: Props) => {
118
95
< Form . Control
119
96
type = "password"
120
97
name = "mnemonicPassword"
121
- placeholder = "Secret password"
98
+ placeholder = "Secret password of wallet seed "
122
99
value = { newMnemonicPassword }
123
100
onChange = { event => setNewMnemonicPassword ( event . target . value ) }
124
101
className = "mt-3"
125
102
/>
126
- < Form . Group controlId = "formCreateSpendingPassword" className = "mt-4" >
127
- < Form . Check
128
- type = "switch"
129
- label = "Create a password to store your settings securely in an encrypted
130
- storage"
131
- onChange = { event => handleCheckCreateSpendingPassword ( event ) }
132
- checked = { mustCreateSpendingPassword }
133
- />
134
- </ Form . Group >
135
- < Form . Group hidden = { hiddenSpendingPassword } >
103
+ < Form . Text >
104
+ This secret password is part of the BIP39 standard to generate safer
105
+ wallet seeds.
106
+ </ Form . Text >
107
+ < Form . Label className = "mt-5" > Unlock wallet (optional):</ Form . Label >
108
+ < Form . Group >
136
109
< Form . Control
137
110
type = "password"
138
111
id = "password"
@@ -154,6 +127,10 @@ export default ({ setAccountFromMnemonic }: Props) => {
154
127
onChange = { event => setConfirmPassword ( event . target . value ) }
155
128
className = "mt-3"
156
129
/>
130
+ < Form . Text >
131
+ This key allows you to unlock your wallet every time you start it
132
+ and to keep your account data in a more secure way.
133
+ </ Form . Text >
157
134
< Form . Label
158
135
className = "text-danger"
159
136
hidden = { arePasswordAndConfirmationEqual }
0 commit comments