Skip to content

Commit

Permalink
Update workEmailDomainRegex
Browse files Browse the repository at this point in the history
  • Loading branch information
mnigh committed Dec 5, 2024
1 parent db738c3 commit 7b13e9d
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)|@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/4
// 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)|@gc\.ca|canada\.ca|elections\.ca|ccc\.ca|canadapost-postescanada\.ca|gg\.ca)$/i;

0 comments on commit 7b13e9d

Please sign in to comment.