Fix method POST
pull/194/head
Pavel Loginov 2019-12-04 21:56:38 +03:00 committed by GitHub
commit a7f43aefd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 143 additions and 123 deletions

9
.gitignore vendored
View File

@ -102,3 +102,12 @@ ENV/
# mypy
.mypy_cache/
#data user
app/certs
map*.png
app/haproxy-wi.db
keys
lists
log
configs

View File

@ -7,7 +7,7 @@ import http.cookies
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/'))
template = env.get_template('add.html')
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
if form.getvalue('add'):

View File

@ -11,7 +11,7 @@ template = env.get_template('config.html')
print('Content-type: text/html\n')
funct.check_login()
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
config_read = ""
cfg = ""
@ -90,4 +90,4 @@ template = template.render(h2 = 1, title = "Working with HAProxy configs",
note = 1,
versions = funct.versions(),
token = token)
print(template)
print(template)

View File

@ -1,6 +1,5 @@
#!/usr/bin/env python3
import os
import sql
import http, cgi
import funct
import sql
@ -10,7 +9,7 @@ template = env.get_template('runtimeapi.html')
print('Content-type: text/html\n')
funct.check_login()
form = cgi.FieldStorage()
form = funct.form
try:
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
@ -37,4 +36,4 @@ output_from_parsed_template = template.render(h2 = 1,
serv = serv,
versions = funct.versions(),
servbackend = servbackend)
print(output_from_parsed_template)
print(output_from_parsed_template)

View File

@ -431,7 +431,6 @@ def check_haproxy_version(serv):
def upload(serv, path, file, **kwargs):
error = ""
full_path = path + file
if kwargs.get('dir') == "fullpath":
full_path = path
@ -453,14 +452,14 @@ def upload(serv, path, file, **kwargs):
logging('localhost', ' Cannot upload '+file+' to '+full_path+'. Error: '+str(e.args), haproxywi=1)
pass
try:
try:
sftp.close()
ssh.close()
except Exception as e:
error = e.args
logging('localhost', str(error[0]), haproxywi=1)
pass
return str(error)
@ -468,7 +467,7 @@ def upload_and_restart(serv, cfg, **kwargs):
import sql
tmp_file = sql.get_setting('tmp_config_path') + "/" + get_data('config') + ".cfg"
error = ""
try:
os.system("dos2unix "+cfg)
except OSError:
@ -491,7 +490,6 @@ def upload_and_restart(serv, cfg, **kwargs):
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') + " && sudo " + sql.get_setting('restart_command') ]
if sql.get_setting('firewall_enable') == "1":
commands.extend(open_port_firewalld(cfg))
error += str(upload(serv, tmp_file, cfg, dir='fullpath'))
try:
@ -500,17 +498,20 @@ def upload_and_restart(serv, cfg, **kwargs):
error += e
if error:
logging('localhost', error, haproxywi=1)
return error
return error
def master_slave_upload_and_restart(serv, cfg, just_save):
import sql
MASTERS = sql.is_master(serv)
error = ""
for master in MASTERS:
if master[0] != None:
upload_and_restart(master[0], cfg, just_save=just_save)
error += upload_and_restart(master[0], cfg, just_save=just_save)
return upload_and_restart(serv, cfg, just_save=just_save)
error += upload_and_restart(serv, cfg, just_save=just_save)
return error
def open_port_firewalld(cfg):
@ -778,4 +779,4 @@ def get_hash(value):
import hashlib
h = hashlib.md5(value.encode('utf-8'))
p = h.hexdigest()
return p
return p

View File

@ -11,7 +11,7 @@ print('Content-type: text/html\n')
funct.check_login()
funct.page_for_admin(level = 2)
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
try:
@ -31,4 +31,4 @@ output_from_parsed_template = template.render(h2 = 1, title = "Configure HA",
selects = servers,
versions = funct.versions(),
token = token)
print(output_from_parsed_template)
print(output_from_parsed_template)

View File

@ -21,7 +21,7 @@ try:
except:
pass
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
if serv:

View File

@ -13,7 +13,7 @@ print('Content-type: text/html\n')
funct.check_login()
funct.page_for_admin(level = 2)
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
log_path = funct.get_config_var('main', 'log_path')
kp_save_configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
@ -90,4 +90,4 @@ output_from_parsed_template = template.render(h2 = 1, title = "Edit Runnig Keepa
keepalived = 1,
versions = funct.versions(),
token = token)
print(output_from_parsed_template)
print(output_from_parsed_template)

View File

@ -1,6 +1,5 @@
#!/usr/bin/env python3
import os
import sql
import http, cgi
import funct
import sql
@ -10,7 +9,7 @@ template = env.get_template('lists.html')
print('Content-type: text/html\n')
funct.check_login()
form = cgi.FieldStorage()
form = funct.form
funct.page_for_admin(level = 2)
try:
@ -52,4 +51,4 @@ template = template.render(h2 = 1,
group = user_group,
versions = funct.versions(),
token = token)
print(template)
print(template)

View File

@ -13,7 +13,7 @@ import uuid
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/'))
template = env.get_template('login.html')
form = cgi.FieldStorage()
form = funct.form
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
user_id = cookie.get('uuid')
@ -69,13 +69,25 @@ def check_in_ldap(user, password):
server = sql.get_setting('ldap_server')
port = sql.get_setting('ldap_port')
ldap_class_search = sql.get_setting('ldap_class_search')
root_user = sql.get_setting('ldap_user')
root_password = sql.get_setting('ldap_password')
ldap_base = sql.get_setting('ldap_base')
domain = sql.get_setting('ldap_domain')
ldap_search_field = sql.get_setting('ldap_search_field')
ldap_user_attribute = sql.get_setting('ldap_user_attribute')
l = ldap.initialize("ldap://"+server+':'+port)
l = ldap.initialize(server+':'+port)
try:
l.protocol_version = ldap.VERSION3
l.set_option(ldap.OPT_REFERRALS, 0)
bind = l.simple_bind_s(ldap_class_search+'='+user, password)
bind = l.simple_bind_s(root_user, root_password)
criteria = "(&(objectClass="+ldap_class_search+")("+ldap_user_attribute+"="+user+"))"
attributes = [ldap_search_field]
result = l.search_s(ldap_base, ldap.SCOPE_SUBTREE, criteria, attributes)
bind = l.simple_bind_s(result[0][0], password)
except ldap.INVALID_CREDENTIALS:
print("Content-type: text/html\n")
print('<center><div class="alert alert-danger">Invalid credentials</div><br /><br />')
@ -170,4 +182,4 @@ output_from_parsed_template = template.render(h2 = 0, title = "Login page",
ref = ref,
versions = funct.versions(),
db_create = db_create)
print(output_from_parsed_template)
print(output_from_parsed_template)

View File

@ -7,7 +7,7 @@ import os, http
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/'))
template = env.get_template('logs.html')
form = cgi.FieldStorage()
form = funct.form
if form.getvalue('grep') is None:
grep = ""

View File

@ -5,7 +5,7 @@ import os, sys
import funct
import sql
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
act = form.getvalue('act')
@ -893,7 +893,7 @@ if form.getvalue('get_ldap_email'):
ldap_class_search = sql.get_setting('ldap_class_search')
ldap_user_attribute = sql.get_setting('ldap_user_attribute')
l = ldap.initialize("ldap://"+server+':'+port)
l = ldap.initialize(server+':'+port)
try:
l.protocol_version = ldap.VERSION3
l.set_option(ldap.OPT_REFERRALS, 0)

View File

@ -11,7 +11,7 @@ template = env.get_template('sections.html')
print('Content-type: text/html\n')
funct.check_login()
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
section = form.getvalue('section')
sections = ""
@ -98,4 +98,4 @@ template = template.render(h2 = 1, title = "Working with HAProxy configs",
note = 1,
versions = funct.versions(),
token = token)
print(template)
print(template)

View File

@ -8,7 +8,7 @@ import sql
from jinja2 import Environment, FileSystemLoader
env = Environment(extensions=["jinja2.ext.do"],loader=FileSystemLoader('templates/'))
template = env.get_template('servers.html')
form = cgi.FieldStorage()
form = funct.form
print('Content-type: text/html\n')
funct.check_login()
@ -38,4 +38,4 @@ output_from_parsed_template = template.render(title = "Servers manage",
token = token,
versions = funct.versions(),
ldap_enable = ldap_enable)
print(output_from_parsed_template)
print(output_from_parsed_template)

View File

@ -1415,8 +1415,8 @@ def check_token_exists(token):
funct.logging('localhost', ' Cannot check token', haproxywi=1)
return False
form = cgi.FieldStorage()
form = funct.form
error_mess = '<span class="alert alert-danger" id="error">All fields must be completed <a title="Close" id="errorMess"><b>X</b></a></span>'

View File

@ -24,7 +24,7 @@ h3 {
</ul>
{% include 'include/add_proxy.html' %}
<div id="listen">
<form name="add-listner" action="/app/add.py">
<form name="add-listner" action="/app/add.py" method="post">
<table class="add-table">
<caption><h3>Add listen</h3></caption>
<tr>
@ -213,7 +213,7 @@ h3 {
<!-- Second tabs -->
<div id="frontend">
<form name="add-frontend" action="/app/add.py" method="get">
<form name="add-frontend" action="/app/add.py" method="post">
<table>
<caption><h3>Add frontend</h3></caption>
<tr>
@ -354,7 +354,7 @@ h3 {
<!-- Third tabs -->
<div id="backend">
<form name="add-backend" action="/app/add.py">
<form name="add-backend" action="/app/add.py" method="post">
<table>
<caption><h3>Add backend</h3></caption>
<tr>
@ -670,7 +670,7 @@ h3 {
</div>
</div>
<div id="userlist">
<form name="add-userlist" action="/app/add.py">
<form name="add-userlist" action="/app/add.py" method="post">
<table>
<caption><h3>Add Userlist</h3></caption>
<tr>
@ -753,4 +753,4 @@ $( function() {
});
});
</script>
{% endblock %}
{% endblock %}

View File

@ -161,7 +161,7 @@
{% if configver %}
<br>
<center>
<form action="versions.py#conf" method="get">
<form action="versions.py#conf" method="post">
<input type="hidden" value="{{serv}}" name="serv">
<input type="hidden" value="{{configver}}" name="configver">
<input type="hidden" value="1" name="config">

View File

@ -23,4 +23,4 @@
</td>
<td></td>
</tr>
{% endfor %}
{% endfor %}

View File

@ -1,5 +1,5 @@
{% from 'include/input_macros.html' import input %}
<form action="diff.py#diff" method="get">
<form action="diff.py#diff" method="post">
<center>
<h4>
<span style="padding: 20px;">Choose left</span>

View File

@ -4,7 +4,7 @@
<center>
<h3>Choose server</h3>
<p>
<form action="{{ action }}" method="get">
<form action="{{ action }}" method="post">
<a class="ui-button ui-widget ui-corner-all" title="Return back" id="back" onclick="history.go(-2)">Back</a>
<select autofocus required name="serv" id="{{ select_id }}">
<option disabled>Choose server</option>
@ -53,7 +53,7 @@
{% if role <= 2 %}
<div id="config">
<h4>Config from {{ serv }}</h4>
<form action="{{ action }}" name="saveconfig" method="get">
<form action="{{ action }}" name="saveconfig" method="post">
<input type="hidden" value="{{ serv }}" name="serv">
<input type="hidden" value="{{ cfg }}.old" name="oldconfig">
<textarea name="config" class="config" rows="35" cols="100">{{ config }}</textarea>
@ -97,4 +97,4 @@
}
$('textarea').linenumbers({col_width: '25px'});
</script>
{% endblock %}
{% endblock %}

View File

@ -3,7 +3,7 @@
<center>
<h3>Choose server</h3>
<p>
<form action="{{ action }}" method="get">
<form action="{{ action }}" method="post">
<a class="ui-button ui-widget ui-corner-all" title="Return back" onclick="history.back()">Back</a>
{% include 'include/select.html' %}
<button type="submit" value="open" name="open" class="btn btn-default">Open</button>

View File

@ -3,7 +3,7 @@
<center>
<h3>Choose server</h3>
<p>
<form action="{{ action }}" method="get">
<form action="{{ action }}" method="post">
<a class="ui-button ui-widget ui-corner-all" title="Return back" onclick="history.back()">Back</a>
{% include 'include/select.html' %}
<button type="submit" value="open" name="open" class="btn btn-default">Open</button>
@ -17,7 +17,7 @@
{% if open %}
<center>
<h4>Choose old version</h4>
<form action="versions.py#conf" method="get">
<form action="versions.py#conf" method="post">
<label for="select_all" id="label_select_all"><b>Select all</b></label>
<input type="checkbox" id="select_all"><br />
{% for file in return_files %}

View File

@ -25,7 +25,7 @@
</tr>
<tr>
<td class="padding10 first-collumn" style="width: 10%;">
<form action="" method="get">
<form action="" method="post">
{% if onclick == 'viewLogs()' %}
<select autofocus required name="serv" id="{{ select_id }}">
<option disabled selected>Choose log</option>

View File

@ -11,7 +11,7 @@
</tr>
<tr>
<td class="padding10 first-collumn" style="width: 25%;">
<form action="{{ action }}" method="get" id="runtimeapiform">
<form action="{{ action }}" method="post" id="runtimeapiform">
{% include 'include/select.html' %}
</td>
<td style="width: 30%;">

View File

@ -3,7 +3,7 @@
<center>
<h3>Choose a section</h3>
<p>
<form action="{{ action }}" method="get">
<form action="{{ action }}" method="post">
{% if aftersave %}
<a class="ui-button ui-widget ui-corner-all" title="Return back" onclick="history.go(-3)">Back</a>
{% else %}
@ -29,7 +29,7 @@
{% if role <= 2 %}
<div id="config">
<h4>You are editting "{{section}}" from server {{ serv }}</h4>
<form action="{{ action }}" name="saveconfig" method="get">
<form action="{{ action }}" name="saveconfig" method="post">
<input type="hidden" value="{{ serv }}" name="serv">
<input type="hidden" value="{{ start_line }}" name="start_line">
<input type="hidden" value="{{ end_line }}" name="end_line">

View File

@ -332,7 +332,7 @@
</table>
</div>
<div id="server-add-table" style="display: none;">
<form id="server-add-form">
<form id="server-add-form" method="post">
<table class="overview">
{% include 'include/admin_add_server.html' %}
<tr>
@ -403,4 +403,4 @@
width: 90px;
}
</style>
{% endblock %}
{% endblock %}

View File

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block content %}
<br />
<form style="padding-left: 5px;" action="viewsttats.py" method="get">
<form style="padding-left: 5px;" action="viewsttats.py" method="post">
<select autofocus required name="serv" id="serv">
<option disabled>Choose server</option>
{% for select in selects %}

View File

@ -10,7 +10,7 @@ import sql
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/'))
template = env.get_template('admin.html')
form = cgi.FieldStorage()
form = funct.form
print('Content-type: text/html\n')

View File

@ -12,7 +12,7 @@ print('Content-type: text/html\n')
funct.check_login()
funct.page_for_admin(level = 2)
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
Select = form.getvalue('del')
configver = form.getvalue('configver')
@ -76,4 +76,4 @@ output_from_parsed_template = template.render(h2 = 1, title = "Working with vers
versions = funct.versions(),
configver = configver,
token = token)
print(output_from_parsed_template)
print(output_from_parsed_template)

View File

@ -8,7 +8,7 @@ import sql
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/'))
template = env.get_template('logs.html')
form = cgi.FieldStorage()
form = funct.form
if form.getvalue('grep') is None:
grep = ""

View File

@ -6,7 +6,7 @@ import sql
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('templates/'))
template = env.get_template('viewstats.html')
form = cgi.FieldStorage()
form = funct.form
serv = form.getvalue('serv')
print('Content-type: text/html\n')

View File

@ -419,7 +419,7 @@ $( function() {
newoptiongroup: $('#group').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('error') != '-1') {
$("#ajax-option").append(data);
@ -473,7 +473,7 @@ $( function() {
newsavedserverdesc: $('#new-saved-servers-description').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('error') != '-1') {
$("#ajax-option").append(data);
@ -747,7 +747,7 @@ $( function() {
ssl_name: $('#ssl_name').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('danger') != '-1') {
@ -769,7 +769,7 @@ $( function() {
getcerts: "viewcert",
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('danger') != '-1') {
$("#ajax-show-ssl").html(data);
@ -957,7 +957,7 @@ function removeOption(id) {
optiondel: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if(data == "Ok ") {
@ -975,7 +975,7 @@ function updateOptions(id) {
id: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -1020,7 +1020,7 @@ function removeSavedServer(id) {
savedserverdel: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if(data == "Ok ") {
@ -1039,7 +1039,7 @@ function updateSavedServer(id) {
id: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -1066,7 +1066,7 @@ function view_ssl(id) {
getcert: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('danger') != '-1') {
$("#ajax-show-ssl").html(data);
@ -1097,7 +1097,7 @@ function change_select_acceleration(id) {
serv: $('#serv'+id+' option:selected').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if(parseFloat(data) < parseFloat('1.8')) {
$("#cache"+id).checkboxradio( "disable" );
@ -1115,7 +1115,7 @@ function change_select_waf(id) {
serv: $('#serv'+id+' option:selected').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if(parseFloat(data) < parseFloat('1.8')) {
$("#waf"+id).checkboxradio( "disable" );

View File

@ -6,7 +6,7 @@ function getChartData(server) {
server: server,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function (result) {
var data = [];
data.push(result.chartData.curr_con);
@ -81,7 +81,7 @@ function getWafChartData(server) {
server: server,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function (result) {
var data = [];
data.push(result.chartData.curr_con);
@ -145,7 +145,7 @@ function loadMetrics() {
beforeSend: function() {
$('#table_metrics').html('<img class="loading_full_page" src="/inc/images/loading.gif" />')
},
type: "GET",
type: "POST",
success: function (data) {
$( "#table_metrics" ).html( data );
}

View File

@ -58,7 +58,7 @@ if(Cookies.get('restart')) {
serv: ip,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if(data.indexOf('ok') != '-1') {
$("#apply").css('display', 'block');
@ -203,7 +203,7 @@ function showOverview() {
beforeSend: function() {
$('#ajaxstatus').html('<img class="loading" src="/inc/images/loading.gif" />')
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajaxstatus").empty();
$("#ajaxstatus").html(data);
@ -222,7 +222,7 @@ function showOverviewServer(name,ip,id) {
page: 'hapservers.py',
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax-server-"+id).empty();
$("#ajax-server-"+id).css('display', 'block');
@ -259,7 +259,7 @@ function showOverviewWaf() {
}
$('#ajaxwafstatus').html('<img class="'+load_class+'" src="/inc/images/loading.gif" />')
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajaxwafstatus").empty();
$("#ajaxwafstatus").html(data);
@ -284,7 +284,7 @@ function showOverviewHapWI() {
beforeSend: function() {
$('#ajaxHapwi').html('<img class="loading_hapwi_overview" src="/inc/images/loading.gif" />')
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajaxHapwi").html(data);
}
@ -298,7 +298,7 @@ function showStats() {
serv: $("#serv").val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
window.history.pushState("Stats", "Stats", cur_url[0]+"?serv="+$("#serv").val());
@ -342,7 +342,7 @@ function showLog() {
minut1: minut1,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
window.history.pushState("Logs", "Logs", cur_url[0]+"?serv="+$("#serv").val()+
@ -369,7 +369,7 @@ function showMap() {
act: "showMap",
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
window.history.pushState("Show map", "Show map", cur_url[0]+'?serv='+$("#serv").val()+'&showMap');
@ -391,7 +391,7 @@ function showRuntime() {
save: saveCheck,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajaxruntime").html(data);
}
@ -406,7 +406,7 @@ function showCompare() {
right: $("#right").val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
}
@ -424,7 +424,7 @@ function showCompareConfigs() {
open: "open",
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax-compare").html(data);
$( "input[type=submit], button" ).button();
@ -445,7 +445,7 @@ function showConfig() {
act: "configShow",
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
$.getScript('/inc/configshow.js');
@ -467,7 +467,7 @@ function showUploadConfig() {
token: $('#token').val(),
view: view
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
if(view == "1") {
@ -501,7 +501,7 @@ function viewLogs() {
minut1: minut1,
token: $('#token').val(),
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
window.history.pushState("View logs", "View logs", cur_url[0]+"?viewlogs="+$("#viewlogs").val()+
@ -694,7 +694,7 @@ $( function() {
login: $('#login').val(),
pass: $('#pass').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('ok') != '-1') {
window.location.replace(ref);
@ -829,7 +829,7 @@ $( function() {
serv: $('#haproxyaddserv option:selected').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/^\s+|\s+$/g,'');
if(data != '') {
@ -898,7 +898,7 @@ function createList(color) {
group: $('#group').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
setTimeout(function() {
@ -916,7 +916,7 @@ function editList(list, color) {
group: $('#group').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('danger') != '-1') {
$("#ajax").html(data);
@ -958,7 +958,7 @@ function saveList(action, list, color) {
bwlists_restart: action,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
}

View File

@ -81,7 +81,7 @@ $( function() {
syn_flood: syn_flood,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('alert') != '-1' || data.indexOf('FAILED') != '-1') {
@ -125,7 +125,7 @@ $( function() {
kp: kp,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -157,7 +157,7 @@ $( function() {
hapver: $('#hapver option:selected' ).val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
@ -187,7 +187,7 @@ $( function() {
update_haproxy_wi: 1,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
@ -247,7 +247,7 @@ $( function() {
newdesc: $('#new-desc').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('error') != '-1') {
$("#ajax-group").append(data);
@ -284,7 +284,7 @@ $( function() {
page: cur_url[0],
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('error') != '-1') {
$("#ajax-ssh").append(data);
@ -323,7 +323,7 @@ $( function() {
page: cur_url[0],
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('error') != '-1') {
$("#ajax-telegram").append(data);
@ -492,7 +492,7 @@ $( function() {
get_ldap_email: $('#new-username').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -560,7 +560,7 @@ function addUser() {
newgroupuser: $('#new-group').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -632,7 +632,7 @@ function addServer() {
active: active,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -669,7 +669,7 @@ function updateSettings(param, val) {
val: val,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -867,7 +867,7 @@ function removeUser(id) {
userdel: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if(data == "Ok ") {
@ -884,7 +884,7 @@ function removeServer(id) {
serverdel: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if(data == "Ok ") {
@ -901,7 +901,7 @@ function removeGroup(id) {
groupdel: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if(data == "Ok ") {
@ -920,7 +920,7 @@ function removeSsh(id) {
sshdel: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if(data == "Ok ") {
@ -939,7 +939,7 @@ function removeTelegram(id) {
telegramdel: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if(data == "Ok ") {
@ -972,7 +972,7 @@ function updateUser(id) {
id: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -1001,7 +1001,7 @@ function updateGroup(id) {
id: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -1066,7 +1066,7 @@ function updateServer(id) {
active: active,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -1097,7 +1097,7 @@ function uploadSsh() {
name: $('#ssh-key-name').val(),
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('danger') != '-1') {
@ -1130,7 +1130,7 @@ function updateSSH(id) {
id: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -1164,7 +1164,7 @@ function updateTelegram(id) {
id: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {
@ -1202,7 +1202,7 @@ function showApacheLog(serv) {
minut1: minut1,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
$("#ajax").html(data);
window.history.pushState("Logs", "Logs", cur_url[0]+"?serv="+serv+"&rows1="+rows+"&grep="+grep+
@ -1221,7 +1221,7 @@ function checkSshConnect(ip) {
serv: ip,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
if (data.indexOf('danger') != '-1') {
$("#ajax").html(data);
@ -1281,7 +1281,7 @@ function changeUserPassword(id, d) {
id: id,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') {

View File

@ -16,7 +16,7 @@ function metrics_waf(name) {
enable: enable,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
showOverviewWaf();
setTimeout(function() {
@ -34,7 +34,7 @@ function installWaf(ip) {
installwaf: ip,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
@ -62,7 +62,7 @@ function changeWafMode(id) {
server_hostname: server_hostname,
token: $('#token').val()
},
type: "GET",
type: "POST",
success: function( data ) {
alert('Do not forget restart WAF server: '+server_hostname)
$( '#'+server_hostname+'-select-line' ).addClass( "update", 1000 );