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){
|
$.get("{{ url_for('app_status') }}", function(data, xhr){
|
||||||
if(xhr.status==401)
|
if(xhr.status==401)
|
||||||
{
|
{
|
||||||
clearTimeout(timer);
|
window.location.href = "{{ url_for('logout') }}";
|
||||||
return
|
|
||||||
}
|
}
|
||||||
for (var apps in data) {
|
for (var apps in data) {
|
||||||
var name = data[apps]["name"];
|
var name = data[apps]["name"];
|
||||||
|
@ -303,8 +302,7 @@ appstatus();
|
||||||
$.get('{{ url_for('loadavg') }}', function(data, xhr) {
|
$.get('{{ url_for('loadavg') }}', function(data, xhr) {
|
||||||
if(xhr.status==401)
|
if(xhr.status==401)
|
||||||
{
|
{
|
||||||
clearTimeout(timer);
|
window.location.href = "{{ url_for('logout') }}";
|
||||||
return
|
|
||||||
}
|
}
|
||||||
$("#load1m").html(data['1m']);
|
$("#load1m").html(data['1m']);
|
||||||
$("#load5m").html(data['5m']);
|
$("#load5m").html(data['5m']);
|
||||||
|
@ -326,8 +324,7 @@ appstatus();
|
||||||
$.get('{{ url_for('disk_free') }}', function(data, xhr) {
|
$.get('{{ url_for('disk_free') }}', function(data, xhr) {
|
||||||
if(xhr.status==401)
|
if(xhr.status==401)
|
||||||
{
|
{
|
||||||
clearTimeout(timer);
|
window.location.href = "{{ url_for('logout') }}";
|
||||||
return
|
|
||||||
}
|
}
|
||||||
for (var mount in data) {
|
for (var mount in data) {
|
||||||
var percent = Math.trunc(data[mount]['perutil']);
|
var percent = Math.trunc(data[mount]['perutil']);
|
||||||
|
@ -354,8 +351,7 @@ appstatus();
|
||||||
$.get('{{ url_for('ram_stats') }}', function(data, xhr) {
|
$.get('{{ url_for('ram_stats') }}', function(data, xhr) {
|
||||||
if(xhr.status==401)
|
if(xhr.status==401)
|
||||||
{
|
{
|
||||||
clearTimeout(timer);
|
window.location.href = "{{ url_for('logout') }}";
|
||||||
return
|
|
||||||
}
|
}
|
||||||
var percent = Math.trunc(data['perutil']);
|
var percent = Math.trunc(data['perutil']);
|
||||||
$("#ramfree").html(data['ramfree']);
|
$("#ramfree").html(data['ramfree']);
|
||||||
|
@ -381,8 +377,7 @@ appstatus();
|
||||||
$.get('{{ url_for('vnstat') }}', function(data, xhr) {
|
$.get('{{ url_for('vnstat') }}', function(data, xhr) {
|
||||||
if(xhr.status==401)
|
if(xhr.status==401)
|
||||||
{
|
{
|
||||||
clearTimeout(timer);
|
window.location.href = "{{ url_for('logout') }}";
|
||||||
return
|
|
||||||
}
|
}
|
||||||
$("#top10").html(data);
|
$("#top10").html(data);
|
||||||
setTimeout(function(){vnstat_top10()}, 600000);
|
setTimeout(function(){vnstat_top10()}, 600000);
|
||||||
|
@ -443,8 +438,7 @@ appstatus();
|
||||||
$.get('{{ url_for('network_quota') }}', function(data, xhr) {
|
$.get('{{ url_for('network_quota') }}', function(data, xhr) {
|
||||||
if(xhr.status==401)
|
if(xhr.status==401)
|
||||||
{
|
{
|
||||||
clearTimeout(timer);
|
window.location.href = "{{ url_for('logout') }}";
|
||||||
return
|
|
||||||
}
|
}
|
||||||
var percent = Math.trunc(data['perutil']);
|
var percent = Math.trunc(data['perutil']);
|
||||||
$("#netfree").html(data['netfree']);
|
$("#netfree").html(data['netfree']);
|
||||||
|
|
Loading…
Reference in a new issue