cleaning up ip filtering

This commit is contained in:
George Shaw 2017-11-30 16:13:34 -06:00
parent a62b2a3cba
commit 32d0876aae
5 changed files with 11 additions and 11 deletions

View file

@ -13,7 +13,7 @@ jQuery('._js_ip-filter-form').on('submit', function(e){
xhr.onloadend = function() {
if (xhr.status == 204) {
ipModal.find('._js_currently-filtered-ips').append('<li>'+requestData["ip"]+'</li>');
listFilteredIPs(requestData["type"]);
}
else {
alert("Something went wrong trying to filter that IP, please contact your administrator if problem persists.");

View file

@ -5,13 +5,13 @@ jQuery('._js_ip-filtering-open').on('click', function(e){
var title;
switch(jQuery(this).attr('data')) {
case "general":
title = "General";
ipModal.find('input[name="type"]').attr('value', 'general');
ipModal.find('#filterIPHelp').html("Filtering this IP under the general filter type will disallow access to the website for all modes.");
case "block":
title = "Block";
ipModal.find('input[name="type"]').attr('value', 'block');
ipModal.find('#filterIPHelp').html("Filtering this IP under the block filter type will disallow access to the website for all modes.");
break;
case "maintenance":
title = "Maintenance Mode";
title = "Maintenance";
ipModal.find('input[name="type"]').attr('value', 'maintenance');
ipModal.find('#filterIPHelp').html("Whitelisting this IP under the maintenance filter type will allow access to the website during maintenance mode.");
break;
@ -19,7 +19,7 @@ jQuery('._js_ip-filtering-open').on('click', function(e){
alert("Error, refresh and try again. If problem persists contact server administrator.");
return;
}
title += " IP Filtering";
title = "IP Filtering - " + title;
ipModal.find('.modal-title').html(title);

View file

@ -144,8 +144,8 @@
IP Filtering
</button>
<div class="dropdown-menu" aria-labelledby="ipFilterDropdown">
<a class="dropdown-item _js_ip-filtering-open" href="#general_ip_filter" data="general">General</a>
<a class="dropdown-item _js_ip-filtering-open" href="#maintenance_ip_filter" data="maintenance">Maintenance Mode</a>
<a class="dropdown-item _js_ip-filtering-open" href="#block_ip_filter" data="block">Block</a>
<a class="dropdown-item _js_ip-filtering-open" href="#maintenance_ip_filter" data="maintenance">Maintenance</a>
</div>
</div>
</div>

View file

@ -29,7 +29,7 @@ func Filter(res http.ResponseWriter, req *http.Request, logger *log.Logger, dir
return false
}
if blockIPRequestData.Type != "maintenance" && blockIPRequestData.Type != "general" {
if blockIPRequestData.Type != "maintenance" && blockIPRequestData.Type != "block" {
logger.Println(req.URL.Path + "::" + " filtered IP type is invalid")
http.Error(res, err.Error(), http.StatusBadRequest)
return false

View file

@ -27,7 +27,7 @@ func List(res http.ResponseWriter, req *http.Request, logger *log.Logger, dir st
return false
}
if listIPRequestData.Type != "maintenance" && listIPRequestData.Type != "general" {
if listIPRequestData.Type != "maintenance" && listIPRequestData.Type != "block" {
logger.Println(req.URL.Path + "::" + " filtered IP type is invalid")
http.Error(res, err.Error(), http.StatusBadRequest)
return false