Skip to content

Commit

Permalink
[Fix] Updates workEmailDomainRegex (#12219)
Browse files Browse the repository at this point in the history
* Update workEmailDomainRegex

* Update workEmailDomainRegex

* Update workEmailDomainRegex
  • Loading branch information
mnigh authored Dec 6, 2024
1 parent 436d1ff commit ac6549d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/app/GraphQL/Validators/UpdateUserAsUserInputValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function rules(): array
*/
Rule::unique('users', 'email')->ignore($this->arg('id'), 'id'),
Rule::unique('users', 'work_email')->ignore($this->arg('id'), 'id'),
// Note: Domains should be kept in sync with the workEmailDomainRegex
'ends_with:gc.ca,canada.ca,elections.ca,ccc.ca,canadapost-postescanada.ca,gg.ca',
// Note: Should be kept in sync with the workEmailDomainRegex
'regex:/@([A-Za-z0-9-]+\.)*(gc\.ca|canada\.ca|elections\.ca|ccc\.ca|canadapost-postescanada\.ca|gg\.ca)$/i',
],
'sub' => [
'sometimes',
Expand Down
4 changes: 2 additions & 2 deletions packages/helpers/src/constants/regularExpressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export const keyStringRegex = /^[a-z]+[_a-z0-9]*$/;
// See: https://regex101.com/r/EAZ8ha/6
export const phoneNumberRegex = /^\+[1-9]\d{1,14}$/;
// See: https://regex101.com/r/T8IYJU/3
// See: https://regex101.com/r/T8IYJU/6
// Note: This should be kept in sync with the check in the UpdateUserInputValidator
export const workEmailDomainRegex =
/(gc\.ca|canada\.ca|elections\.ca|ccc\.ca|canadapost-postescanada\.ca|gg\.ca)$/i;
/@([A-Za-z0-9-]+\.)*(gc\.ca|canada\.ca|elections\.ca|ccc\.ca|canadapost-postescanada\.ca|gg\.ca)$/i;

0 comments on commit ac6549d

Please sign in to comment.