Merge pull request #299 from mailvelope/email_regex_escape
Escape email before using as regular expression in emailCheck method.
This commit is contained in:
commit
350c5891a1
|
@ -123,7 +123,9 @@ KeyArray.prototype.getForAddress = function(email) {
|
|||
* @return {Boolean} True if the email address is defined in the specified 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();
|
||||
for (var i = 0; i < keyEmails.length; i++) {
|
||||
if (emailRegex.test(keyEmails[i].toLowerCase())) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user