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
a41c68bd
Commit
a41c68bd
authored
Jul 12, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add password confirmation box, add password strength checker
parent
9a5f3910
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
11 deletions
+63
-11
create.component.html
Breeze.UI/src/app/setup/create/create.component.html
+6
-0
create.component.ts
Breeze.UI/src/app/setup/create/create.component.ts
+27
-9
password-validation.directive.spec.ts
...p/shared/directives/password-validation.directive.spec.ts
+8
-0
password-validation.directive.ts
...rc/app/shared/directives/password-validation.directive.ts
+19
-0
shared.module.ts
Breeze.UI/src/app/shared/shared.module.ts
+2
-1
wallet.module.ts
Breeze.UI/src/app/wallet/wallet.module.ts
+1
-1
No files found.
Breeze.UI/src/app/setup/create/create.component.html
View file @
a41c68bd
...
...
@@ -16,6 +16,12 @@
<input
type=
"password"
class=
"form-control form-control-success"
formControlName=
"walletPassword"
id=
"walletPassword"
placeholder=
"Enter a password."
>
<div
*
ngIf=
"formErrors.walletPassword"
class=
"form-control-feedback"
>
{{ formErrors.walletPassword }}
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"text-left"
for=
"walletPasswordConfirmation"
>
Confirm Password
</label>
<input
type=
"password"
class=
"form-control form-control-success"
formControlName=
"walletPasswordConfirmation"
id=
"walletPasswordConfirmation"
placeholder=
"Enter a password."
>
<div
*
ngIf=
"formErrors.walletPasswordConfirmation"
class=
"form-control-feedback"
>
{{ formErrors.walletPasswordConfirmation }}
</div>
<div
class=
"form-control-feedback"
>
Your password will be required to recover your wallet in the future. Keep it safe.
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"text-left"
for=
"walletNetwork"
>
Network
</label>
<select
class=
"form-control custom-select"
name=
"network"
formControlName=
"selectNetwork"
>
...
...
Breeze.UI/src/app/setup/create/create.component.ts
View file @
a41c68bd
...
...
@@ -5,6 +5,8 @@ import { Router } from '@angular/router';
import
{
GlobalService
}
from
'../../shared/services/global.service'
;
import
{
ApiService
}
from
'../../shared/services/api.service'
;
import
{
PasswordValidationDirective
}
from
'../../shared/directives/password-validation.directive'
;
import
{
WalletCreation
}
from
'../../shared/classes/wallet-creation'
;
import
{
Mnemonic
}
from
'../../shared/classes/mnemonic'
;
...
...
@@ -25,14 +27,23 @@ export class CreateComponent {
private
buildCreateForm
():
void
{
this
.
createWalletForm
=
this
.
fb
.
group
({
"walletName"
:
[
""
,
[
"walletName"
:
[
""
,
Validators
.
compose
([
Validators
.
required
,
Validators
.
minLength
(
3
),
Validators
.
maxLength
(
24
)
]
Validators
.
maxLength
(
24
),
Validators
.
pattern
(
/^
[
a-zA-Z0-9
]
*$/
)
])
],
"walletPassword"
:
[
""
,
Validators
.
compose
([
Validators
.
required
,
Validators
.
pattern
(
/^
(?=
.*
[
a-z
])(?=
.*
[
A-Z
])(?=
.*
[
0-9
])(?=
.
{10,})
/
)])
],
"walletPassword"
:
[
""
,
Validators
.
required
],
"walletPassword
Confirmation
"
:
[
""
,
Validators
.
required
],
"selectNetwork"
:
[
"test"
,
Validators
.
required
]
},
{
validator
:
PasswordValidationDirective
.
MatchPassword
});
this
.
createWalletForm
.
valueChanges
...
...
@@ -58,17 +69,24 @@ export class CreateComponent {
formErrors
=
{
'walletName'
:
''
,
'walletPassword'
:
''
'walletPassword'
:
''
,
'walletPasswordConfirmation'
:
''
};
validationMessages
=
{
'walletName'
:
{
'required'
:
'Name is required.'
,
'minlength'
:
'Name must be at least 3 characters long.'
,
'maxlength'
:
'Name cannot be more than 24 characters long.'
'maxlength'
:
'Name cannot be more than 24 characters long.'
,
'pattern'
:
'Enter a valid wallet name. [a-Z] and [0-9] are the only characters allowed.'
},
'walletPassword'
:
{
'required'
:
'A password is required.'
'required'
:
'A password is required.'
,
'pattern'
:
'A password must be at least 10 characters long and contain one lowercase and uppercase alphabetical character and a number.'
},
'walletPasswordConfirmation'
:
{
'required'
:
'Confirm your password.'
,
'walletPasswordConfirmation'
:
'Passwords do not match.'
}
};
...
...
Breeze.UI/src/app/shared/directives/password-validation.directive.spec.ts
0 → 100644
View file @
a41c68bd
import
{
PasswordValidationDirective
}
from
'./password-validation.directive'
;
describe
(
'PasswordValidationDirective'
,
()
=>
{
it
(
'should create an instance'
,
()
=>
{
const
directive
=
new
PasswordValidationDirective
();
expect
(
directive
).
toBeTruthy
();
});
});
Breeze.UI/src/app/shared/directives/password-validation.directive.ts
0 → 100644
View file @
a41c68bd
import
{
Directive
}
from
'@angular/core'
;
import
{
AbstractControl
}
from
'@angular/forms'
;
@
Directive
({
selector
:
'[appPasswordValidation]'
})
export
class
PasswordValidationDirective
{
constructor
()
{
}
static
MatchPassword
(
AC
:
AbstractControl
)
{
let
password
=
AC
.
get
(
'walletPassword'
).
value
;
let
confirmPassword
=
AC
.
get
(
'walletPasswordConfirmation'
).
value
;
if
(
password
!=
confirmPassword
)
{
AC
.
get
(
'walletPasswordConfirmation'
).
setErrors
(
{
walletPasswordConfirmation
:
true
}
)
}
else
{
return
null
}
}
}
\ No newline at end of file
Breeze.UI/src/app/shared/shared.module.ts
View file @
a41c68bd
...
...
@@ -2,10 +2,11 @@ import { NgModule, ModuleWithProviders } from '@angular/core';
import
{
CommonModule
}
from
'@angular/common'
;
import
{
CoinNotationPipe
}
from
'./pipes/coin-notation.pipe'
;
import
{
AutoFocusDirective
}
from
'./directives/auto-focus.directive'
;
import
{
PasswordValidationDirective
}
from
'./directives/password-validation.directive'
;
@
NgModule
({
imports
:
[
CommonModule
],
declarations
:
[
CoinNotationPipe
,
AutoFocusDirective
],
declarations
:
[
CoinNotationPipe
,
AutoFocusDirective
,
PasswordValidationDirective
],
exports
:
[
CoinNotationPipe
,
AutoFocusDirective
]
})
...
...
Breeze.UI/src/app/wallet/wallet.module.ts
View file @
a41c68bd
...
...
@@ -7,7 +7,7 @@ import { MenuComponent } from './menu/menu.component';
import
{
DashboardComponent
}
from
'./dashboard/dashboard.component'
;
import
{
HistoryComponent
}
from
'./history/history.component'
;
import
{
SharedModule
}
from
'../shared/shared.module'
;
import
{
SharedModule
}
from
'../shared/shared.module'
;
import
{
WalletRoutingModule
}
from
'./wallet-routing.module'
;
import
{
SidebarComponent
}
from
'./sidebar/sidebar.component'
;
import
{
StatusBarComponent
}
from
'./status-bar/status-bar.component'
;
...
...
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