Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit a593de7

Browse files
Hubert KosterHubert Koster
authored andcommitted
expanding regex with unicode filtering.
1 parent e4efedb commit a593de7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/javascript/app/common/form_validation.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,16 @@ const Validation = (() => {
159159
// ------------------------------
160160
// ----- Validation Methods -----
161161
// ------------------------------
162+
163+
// The unicodes in the validEmail check, only select latin alphabet characters.
164+
// This allows filtering other invalid unicode alphabet characters.
165+
const validEmail = value => /^(([a-zA-Z0-9\u0080-\u00ff\u0100-\u017f\u0180-\u024f][^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z0-9]+\.)+[a-zA-Z]{2,}))$/.test(value);
162166
const validRequired = (value, options, field) => {
163167
if (value.length) return true;
164168
// else
165169
ValidatorsMap.get().req.message = field.type === 'checkbox' ? localize('Please select the checkbox.') : localize('This field is required.');
166170
return false;
167171
};
168-
const validEmail = value => /^(([^<>()[\]\\.,;:\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,}))$/.test(value);
169172
const validPassword = (value, options, field) => {
170173
if (/^(?=.*[a-z])(?=.*[0-9])(?=.*[A-Z])[ -~]*$/.test(value)) {
171174
Password.checkPassword(field.selector, true);

0 commit comments

Comments
 (0)