Skip to content
Snippets Groups Projects
Commit 820ff130 authored by Uma's avatar Uma
Browse files

Fixes email fields validation for xss attack

parent ac510c73
No related branches found
No related tags found
No related merge requests found
......@@ -281,6 +281,11 @@ jQuery.Class("Emails_MassEdit_Js",{},{
return { id: term, text: term };
}
},
escapeMarkup: function(m) {
// Do not escape HTML in the select options text
m = vtUtils.stripTags(String(m),'<i><b>');
return m;
}
}).on("change", function (selectedData) {
var addedElement = selectedData.added;
......
......@@ -366,6 +366,14 @@ var vtUtils = {
jQuery(function () {
jQuery('[data-toggle="tooltip"]').tooltip(options);
});
},
stripTags : function(string,allowed) {
//https://stackoverflow.com/questions/5601903/jquery-almost-equivalent-of-phps-strip-tags#answer-46483672
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('');
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;
return string.replace(tags, function ($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment