Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
67ea0921
Commit
67ea0921
authored
Apr 27, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make recovery form a reactive form
parent
ec1245d5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
41 deletions
+76
-41
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+5
-1
create.component.ts
Breeze.UI/src/app/setup/create/create.component.ts
+7
-2
recover.component.html
Breeze.UI/src/app/setup/recover/recover.component.html
+24
-24
recover.component.ts
Breeze.UI/src/app/setup/recover/recover.component.ts
+30
-13
wallet-recovery.ts
Breeze.UI/src/app/shared/classes/wallet-recovery.ts
+10
-1
No files found.
Breeze.UI/src/app/login/login.component.ts
View file @
67ea0921
...
...
@@ -33,7 +33,11 @@ export class LoginComponent implements OnInit {
private
onDecryptClicked
()
{
this
.
setGlobalWalletName
(
this
.
openWalletForm
.
get
(
"selectWallet"
).
value
);
let
walletLoad
=
new
WalletLoad
(
this
.
openWalletForm
.
get
(
"password"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
openWalletForm
.
get
(
"selectWallet"
).
value
);
let
walletLoad
=
new
WalletLoad
(
this
.
openWalletForm
.
get
(
"password"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
openWalletForm
.
get
(
"selectWallet"
).
value
);
this
.
loadWallet
(
walletLoad
);
}
...
...
Breeze.UI/src/app/setup/create/create.component.ts
View file @
67ea0921
...
...
@@ -22,14 +22,19 @@ export class CreateComponent {
});
}
private
newWallet
:
WalletCreation
;
private
createWalletForm
:
FormGroup
;
private
newWallet
:
WalletCreation
;
private
responseMessage
:
string
;
private
errorMessage
:
string
;
private
onCreateClicked
()
{
this
.
newWallet
=
new
WalletCreation
(
this
.
createWalletForm
.
get
(
"walletPassword"
).
value
,
this
.
createWalletForm
.
get
(
"selectNetwork"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
createWalletForm
.
get
(
"walletName"
).
value
);
this
.
newWallet
=
new
WalletCreation
(
this
.
createWalletForm
.
get
(
"walletPassword"
).
value
,
this
.
createWalletForm
.
get
(
"selectNetwork"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
createWalletForm
.
get
(
"walletName"
).
value
);
this
.
createWallet
(
this
.
newWallet
);
}
...
...
Breeze.UI/src/app/setup/recover/recover.component.html
View file @
67ea0921
...
...
@@ -2,27 +2,27 @@
<p>
Welcome, please complete the form below to recover your wallet.
</p>
<div
class=
"form-group"
>
<label
for=
"name"
>
Mnemonic:
</label>
<input
class=
"form-control"
type=
"text"
#
walletMnemonic
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
Password:
</label>
<input
class=
"form-control"
type=
"password"
#
walletPassword
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
Wallet Path:
</label>
<input
class=
"form-control"
type=
"text"
#
walletPath
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"name"
>
Wallet Name:
</label>
<input
class=
"form-control"
type=
"text"
#
walletName
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"networklabel"
>
Network:
</label>
<select
name=
"network"
#
walletNetwork
>
<form
[
formGroup
]="
recoverWalletForm
"
(
ngSubmit
)="
onRecoverClicked
()"
>
<div
class=
"form-group"
>
<label>
Mnemonic:
</label>
<input
class=
"form-control"
formControlName=
"walletMnemonic"
type=
"text"
placeholder=
"Enter your saved mnemonic."
>
</div>
<div
class=
"form-group"
>
<label>
Wallet password:
</label>
<input
class=
"form-control"
type=
"password"
formControlName=
"walletPassword"
placeholder=
"Enter password here."
>
</div>
<div
class=
"form-group"
>
<label>
Name:
</label>
<input
class=
"form-control"
formControlName=
"walletName"
type=
"text"
placeholder=
"Enter a name for your wallet."
>
</div>
<div
class=
"form-group"
>
<label>
Network:
</label>
<select
name=
"network"
formControlName=
"selectNetwork"
>
<option
value=
"main"
>
Main
</option>
<option
value=
"test"
>
Testnet
</option>
</select>
</div>
<button
type=
"submit"
(
click
)="
recoverWallet
(
walletMnemonic
.
value
,
walletPassword
.
value
,
walletPath
.
value
,
walletName
.
value
,
walletNetwork
.
value
)"
>
Recover
</button>
\ No newline at end of file
</div>
<div
class=
"form-group"
>
<button
type=
"submit"
[
disabled
]="!
recoverWalletForm
.
valid
"
class=
"btn btn-success"
>
Recover Wallet
</button>
</div>
</form>
Breeze.UI/src/app/setup/recover/recover.component.ts
View file @
67ea0921
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ApiService
}
from
'../../shared/services/api.service'
import
{
WalletRecovery
}
from
'../../shared/classes/wallet-recovery'
import
{
FormGroup
,
FormControl
,
Validators
,
FormBuilder
}
from
'@angular/forms'
;
import
{
GlobalService
}
from
'../../shared/services/global.service'
;
import
{
ApiService
}
from
'../../shared/services/api.service'
;
import
{
WalletRecovery
}
from
'../../shared/classes/wallet-recovery'
;
@
Component
({
selector
:
'app-recover'
,
...
...
@@ -9,8 +13,16 @@ import { WalletRecovery } from '../../shared/classes/wallet-recovery'
})
export
class
RecoverComponent
implements
OnInit
{
constructor
(
private
apiService
:
ApiService
)
{
}
constructor
(
private
globalService
:
GlobalService
,
private
apiService
:
ApiService
,
private
fb
:
FormBuilder
)
{
this
.
recoverWalletForm
=
fb
.
group
({
"walletMnemonic"
:
[
""
,
Validators
.
required
],
"walletPassword"
:
[
""
,
Validators
.
required
],
"walletName"
:
[
""
,
Validators
.
required
],
"selectNetwork"
:
[
"main"
,
Validators
.
required
]
});
}
private
recoverWalletForm
:
FormGroup
;
private
walletRecovery
:
WalletRecovery
;
private
responseMessage
:
string
;
...
...
@@ -19,16 +31,21 @@ export class RecoverComponent implements OnInit {
ngOnInit
()
{
}
private
recoverWallet
(
mnemonic
:
string
,
password
:
string
,
folderPath
:
string
,
name
:
string
,
network
:
string
)
{
this
.
walletRecovery
=
new
WalletRecovery
();
this
.
walletRecovery
.
mnemonic
=
mnemonic
;
this
.
walletRecovery
.
password
=
password
;
this
.
walletRecovery
.
folderPath
=
folderPath
;
this
.
walletRecovery
.
name
=
name
;
this
.
walletRecovery
.
network
=
network
;
private
onRecoverClicked
(){
this
.
walletRecovery
=
new
WalletRecovery
(
this
.
recoverWalletForm
.
get
(
"walletMnemonic"
).
value
,
this
.
recoverWalletForm
.
get
(
"walletPassword"
).
value
,
this
.
recoverWalletForm
.
get
(
"selectNetwork"
).
value
,
this
.
globalService
.
getWalletPath
(),
this
.
recoverWalletForm
.
get
(
"walletName"
).
value
);
this
.
recoverWallet
(
this
.
walletRecovery
);
}
private
recoverWallet
(
recoverWallet
:
WalletRecovery
)
{
this
.
apiService
.
recoverWallet
(
this
.
walletRecovery
)
.
recoverWallet
(
recoverWallet
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
...
...
Breeze.UI/src/app/shared/classes/wallet-recovery.ts
View file @
67ea0921
export
class
WalletRecovery
{
constructor
(
mnemonic
:
string
,
password
:
string
,
network
:
string
,
folderPath
:
string
,
name
:
string
)
{
this
.
mnemonic
=
mnemonic
;
this
.
password
=
password
;
this
.
network
=
network
;
this
.
folderPath
=
folderPath
;
this
.
name
=
name
;
}
mnemonic
:
string
;
password
:
string
;
folderPath
:
string
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment