Bug 1799390 - Improve pill email validation to at least not allow space and double @. r=aleca

From https://stackoverflow.com/questions/46155/how-can-i-validate-an-email-address-in-javascript#answer-9204568

Differential Revision: https://phabricator.services.mozilla.com/D162383

--HG--
extra : rebase_source : a324290179142e7b27b98b905c44c0b6b0fbcdca
extra : amend_source : d897527d05909b6aff67b6f7470c5bb3f8266c74
This commit is contained in:
Magnus Melin 2022-11-20 21:33:01 +11:00
Родитель 5f617743e0
Коммит bd5b24388a
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -1264,7 +1264,7 @@
* @param {String} address - An email address.
*/
isValidAddress(address) {
return address.includes("@", 1) && !address.endsWith("@");
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(address);
}
/**