Skip to content

Commit

Permalink
[4.1.x][6645] Valid email address should follow RFC rules (craftercms…
Browse files Browse the repository at this point in the history
…#3779)

* Valid email address should follow RFC rules #6645

* Remove unnecessary global and multiline flags from email regex #6645

* Remove unnecessary escaped chars from email regex #6645
  • Loading branch information
jvega190 committed Mar 27, 2024
1 parent 80ab0a0 commit 1b4920f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/app/src/components/UserManagement/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export const minLengthMap = {
};

export const isInvalidEmail = (email: string) => {
const emailRegex = /^([\w\d._\-#])+@([\w\d._\-#]+[.][\w\d._\-#]+)+$/g;
// From https://emailregex.com/, according to the RFC 5322 standard
const emailRegex =
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return Boolean(email) && !emailRegex.test(email);
};

Expand Down

0 comments on commit 1b4920f

Please sign in to comment.