Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oser-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hamza Touizrat
oser-frontend
Commits
48ffc696
Unverified
Commit
48ffc696
authored
3 years ago
by
ThomasBidot
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Back to no email verification
parent
0068319b
No related branches found
No related tags found
1 merge request
!75
Authorize valid profile
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/signup/core/customValidationModule.ts
+0
-45
0 additions, 45 deletions
src/app/signup/core/customValidationModule.ts
with
0 additions
and
45 deletions
src/app/signup/core/customValidationModule.ts
deleted
100644 → 0
+
0
−
45
View file @
0068319b
import
{
FormGroup
,
FormControl
,
FormGroupDirective
,
NgForm
,
ValidatorFn
}
from
'
@angular/forms
'
;
import
{
ErrorStateMatcher
}
from
'
@angular/material
'
;
//from https://obsessiveprogrammer.com/validating-confirmation-fields-in-angular-reactive-forms-with-angular-material/
/**
* Custom validator functions for reactive form validation
*/
export
class
CustomValidators
{
/**
* Validates that child controls in the form group are equal
*/
static
childrenEqual
:
ValidatorFn
=
(
formGroup
:
FormGroup
)
=>
{
const
[
firstControlName
,
...
otherControlNames
]
=
Object
.
keys
(
formGroup
.
controls
||
{});
const
isValid
=
otherControlNames
.
every
(
controlName
=>
formGroup
.
get
(
controlName
).
value
===
formGroup
.
get
(
firstControlName
).
value
);
return
isValid
?
null
:
{
childrenNotEqual
:
true
};
}
}
/**
* Custom ErrorStateMatcher which returns true (error exists) when the parent form group is invalid and the control has been touched
*/
export
class
ConfirmValidParentMatcher
implements
ErrorStateMatcher
{
isErrorState
(
control
:
FormControl
|
null
,
form
:
FormGroupDirective
|
NgForm
|
null
):
boolean
{
return
control
.
parent
.
invalid
&&
control
.
touched
;
}
}
/**
* Collection of reusable RegExps
*/
// export const regExps: { [key: string]: RegExp } = {
// password: /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{7,15}$/
// };
/**
* Collection of reusable error messages
*/
export
const
errorMessages
:
{
[
key
:
string
]:
string
}
=
{
fullName
:
'
Full name must be between 1 and 128 characters
'
,
email
:
'
La forme de l
\'
adresse email doit être valide (username@domain)
'
,
confirmEmail
:
'
Les adresses email doivent être identiques
'
,
// password: 'Password must be between 7 and 15 characters, and contain at least one number and special character',
confirmPassword
:
'
Les mots de passe doivent être identiques
'
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment