Escape email before using as regular expression in emailCheck method.
This commit is contained in:
parent
37091175b1
commit
be6ae2c464
|
@ -123,7 +123,9 @@ KeyArray.prototype.getForAddress = function(email) {
|
||||||
* @return {Boolean} True if the email address is defined in the specified key
|
* @return {Boolean} True if the email address is defined in the specified key
|
||||||
*/
|
*/
|
||||||
function emailCheck(email, key) {
|
function emailCheck(email, key) {
|
||||||
var emailRegex = new RegExp('<' + email.toLowerCase() + '>');
|
// escape email before using in regular expression
|
||||||
|
email = email.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
var emailRegex = new RegExp('<' + email + '>');
|
||||||
var keyEmails = key.getUserIds();
|
var keyEmails = key.getUserIds();
|
||||||
for (var i = 0; i < keyEmails.length; i++) {
|
for (var i = 0; i < keyEmails.length; i++) {
|
||||||
if (emailRegex.test(keyEmails[i].toLowerCase())) {
|
if (emailRegex.test(keyEmails[i].toLowerCase())) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user