Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
Intranet
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matteo
Intranet
Commits
d16d2947
Commit
d16d2947
authored
Feb 21, 2022
by
Matteo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix validazione doppia password
parent
91de80e7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
16 deletions
+17
-16
registrazione.page.html
src/app/auth/pages/registrazione/registrazione.page.html
+3
-3
registrazione.page.ts
src/app/auth/pages/registrazione/registrazione.page.ts
+2
-2
auth.service.ts
src/app/auth/service/auth.service.ts
+1
-1
password.validator.ts
src/app/auth/validators/password.validator.ts
+11
-10
No files found.
src/app/auth/pages/registrazione/registrazione.page.html
View file @
d16d2947
...
...
@@ -21,7 +21,7 @@
{{ 'registrazione' | translate }}
</div>
</div>
<ion-grid
class=
"transparent bc-grid"
>
<ion-grid
class=
"transparent bc-grid"
>
<ion-row
class=
"transparent"
>
<ion-col
align-self-end
size-md=
"6"
size-lg=
"6"
size-xs=
"12"
class=
"transparent"
>
<div
class=
"body-form body-img12"
>
...
...
@@ -55,10 +55,10 @@
<ion-input
formControlName=
"cellulare"
type=
"tel"
placeholder=
"{{ 'cellulare' | translate }}"
ngModel
required
></ion-input>
</ion-item>
<ion-item>
<ion-input
formControlName=
"password"
type=
"password"
placeholder=
"{{ 'pwd' | translate }}"
ngModel
required
></ion-input>
<ion-input
formControlName=
"
new
password"
type=
"password"
placeholder=
"{{ 'pwd' | translate }}"
ngModel
required
></ion-input>
</ion-item>
<ion-item>
<ion-input
formControlName=
"passwordbis"
type=
"password"
placeholder=
"{{ 'repeat_pwd' | translate }}"
ngModel
required
></ion-input>
<ion-input
formControlName=
"
new
passwordbis"
type=
"password"
placeholder=
"{{ 'repeat_pwd' | translate }}"
ngModel
required
></ion-input>
</ion-item>
</div>
<div
padding
>
...
...
src/app/auth/pages/registrazione/registrazione.page.ts
View file @
d16d2947
...
...
@@ -79,12 +79,12 @@ export class RegistrazionePage implements OnInit {
cellulare
:
new
FormControl
(
''
,
Validators
.
compose
([
Validators
.
pattern
(
'^[0-9]+$'
),
])),
password
:
new
FormControl
(
''
,
Validators
.
compose
([
new
password
:
new
FormControl
(
''
,
Validators
.
compose
([
Validators
.
minLength
(
5
),
Validators
.
required
,
Validators
.
pattern
(
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]+$'
)
//this is for the letters (both uppercase and lowercase) and numbers validation
])),
passwordbis
:
new
FormControl
(
''
,
Validators
.
compose
([
new
passwordbis
:
new
FormControl
(
''
,
Validators
.
compose
([
Validators
.
required
]))
},(
formGroup
:
FormGroup
)
=>
{
...
...
src/app/auth/service/auth.service.ts
View file @
d16d2947
...
...
@@ -158,7 +158,7 @@ export class AuthService {
registra
(
value
)
:
Observable
<
ErrorResponse
>
{
this
.
tipoStruttura
=
environment
.
struttura
;
var
param
=
UtilService
.
encodeBody
({
nome
:
value
.
nome
,
cognome
:
value
.
cognome
,
email
:
value
.
email
,
cellulare
:
value
.
cellulare
,
password
:
value
.
password
,
tipostruttura
:
this
.
tipoStruttura
});
var
param
=
UtilService
.
encodeBody
({
nome
:
value
.
nome
,
cognome
:
value
.
cognome
,
email
:
value
.
email
,
cellulare
:
value
.
cellulare
,
password
:
value
.
new
password
,
tipostruttura
:
this
.
tipoStruttura
});
this
.
clientiSalvati
=
false
;
return
this
.
httpClient
.
post
<
ErrorResponse
>
(
this
.
httpClientDataService
.
BASE_ADDRESS
+
'/autenticazione/registrazione.do'
,
param
,
this
.
httpClientDataService
.
httpOptions
)
.
pipe
(
...
...
src/app/auth/validators/password.validator.ts
View file @
d16d2947
...
...
@@ -8,20 +8,22 @@ static equals = (newpasswordControl: AbstractControl): ValidatorFn => {
return
(
passwordBisControl
:
AbstractControl
):
{[
key
:
string
]:
boolean
}
=>
{
if
(
newpasswordControl
.
value
==
passwordBisControl
.
value
)
{
return
{
equals
:
tru
e
equals
:
fals
e
};
}
else
return
null
;
else
return
{
equals
:
true
};;
};
}
static
areEqual
(
formGroup
:
FormGroup
)
{
static
areEqual
(
formGroup
:
FormGroup
)
{
let
val
;
let
valid
=
true
;
for
(
let
key
in
formGroup
.
controls
)
{
if
(
formGroup
.
controls
.
hasOwnProperty
(
key
))
{
if
(
key
==
"oldpassword
"
)
continue
;
if
(
key
!=
"newpassword"
&&
key
!=
"newpasswordbis
"
)
continue
;
let
control
:
FormControl
=
<
FormControl
>
formGroup
.
controls
[
key
];
if
(
val
===
undefined
)
{
val
=
control
.
value
...
...
@@ -33,14 +35,12 @@ static areEqual(formGroup: FormGroup) {
}
}
}
if
(
!
valid
)
/*
{
return null;
if
(
!
valid
)
{
//
return null;
return
{
areEqual:
fals
e
areEqual
:
tru
e
}
}*/
return
{
areEqual
:
true
}
return
null
;
}
}
\ No newline at end of file
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