mirror of
https://github.com/swizzin/swizzin_dashboard.git
synced 2024-09-20 06:46:08 +08:00
auth: forcefully logout if an ajax call returns 401
This *should* fix fail2ban banning overzealous groups of ajax queries by fully logging out immediately upon the first bad request.
This commit is contained in:
parent
0dc9dc6fa4
commit
a5335490b2
|
@ -275,8 +275,7 @@ function appstatus(){
|
|||
$.get("{{ url_for('app_status') }}", function(data, xhr){
|
||||
if(xhr.status==401)
|
||||
{
|
||||
clearTimeout(timer);
|
||||
return
|
||||
window.location.href = "{{ url_for('logout') }}";
|
||||
}
|
||||
for (var apps in data) {
|
||||
var name = data[apps]["name"];
|
||||
|
@ -303,8 +302,7 @@ appstatus();
|
|||
$.get('{{ url_for('loadavg') }}', function(data, xhr) {
|
||||
if(xhr.status==401)
|
||||
{
|
||||
clearTimeout(timer);
|
||||
return
|
||||
window.location.href = "{{ url_for('logout') }}";
|
||||
}
|
||||
$("#load1m").html(data['1m']);
|
||||
$("#load5m").html(data['5m']);
|
||||
|
@ -326,8 +324,7 @@ appstatus();
|
|||
$.get('{{ url_for('disk_free') }}', function(data, xhr) {
|
||||
if(xhr.status==401)
|
||||
{
|
||||
clearTimeout(timer);
|
||||
return
|
||||
window.location.href = "{{ url_for('logout') }}";
|
||||
}
|
||||
for (var mount in data) {
|
||||
var percent = Math.trunc(data[mount]['perutil']);
|
||||
|
@ -354,8 +351,7 @@ appstatus();
|
|||
$.get('{{ url_for('ram_stats') }}', function(data, xhr) {
|
||||
if(xhr.status==401)
|
||||
{
|
||||
clearTimeout(timer);
|
||||
return
|
||||
window.location.href = "{{ url_for('logout') }}";
|
||||
}
|
||||
var percent = Math.trunc(data['perutil']);
|
||||
$("#ramfree").html(data['ramfree']);
|
||||
|
@ -381,8 +377,7 @@ appstatus();
|
|||
$.get('{{ url_for('vnstat') }}', function(data, xhr) {
|
||||
if(xhr.status==401)
|
||||
{
|
||||
clearTimeout(timer);
|
||||
return
|
||||
window.location.href = "{{ url_for('logout') }}";
|
||||
}
|
||||
$("#top10").html(data);
|
||||
setTimeout(function(){vnstat_top10()}, 600000);
|
||||
|
@ -443,8 +438,7 @@ appstatus();
|
|||
$.get('{{ url_for('network_quota') }}', function(data, xhr) {
|
||||
if(xhr.status==401)
|
||||
{
|
||||
clearTimeout(timer);
|
||||
return
|
||||
window.location.href = "{{ url_for('logout') }}";
|
||||
}
|
||||
var percent = Math.trunc(data['perutil']);
|
||||
$("#netfree").html(data['netfree']);
|
||||
|
|
Loading…
Reference in a new issue