[Rspamd] Pushover, check sender by regex

This commit is contained in:
andryyy
2020-04-16 21:58:30 +02:00
parent 7fa10cc3b4
commit 47a15c21aa
9 changed files with 82 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ $(document).ready(function() {
var re = /^(([^<>()[\]\\.,;:\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,}))$/;
return re.test(email);
}
function validateRegex(e){var t=e.split("/"),n=e,r="";t.length>1&&(n=t[1],r=t[2]);try{return new RegExp(n,r),!0}catch(e){return!1}}
function is_active(elem) {
if ($(elem).data('submitted') == '1') {
return true;
@@ -134,6 +135,18 @@ $(document).ready(function() {
}
}
}
if ($(this).val() && $(this).attr("regex")) {
var regex_content = $(this).val();
$(this).removeClass('inputMissingAttr');
if(!validateRegex(regex_content)) {
invalid = true;
$(this).addClass('inputMissingAttr');
}
if(!regex_content.startsWith('/') || !/\/[ims]?$/.test(regex_content)){
invalid = true;
$(this).addClass('inputMissingAttr');
}
}
});
if (!invalid) {
var attr_to_merge = $(this).closest("form").serializeObject();