mirror of https://github.com/Aidaho12/haproxy-wi
parent
cf7e15f00b
commit
f1f83eab94
|
@ -178,7 +178,7 @@ For Apache do virtualhost with cgi-bin. Like this:
|
|||
```
|
||||
|
||||
# OS support
|
||||
HAProxy-WI was tested on EL 7, and all scripts too. Debian/Ubuntu OS support at 'beta' stage, may work not correct
|
||||
HAProxy-WI was tested on EL7, EL8 and all scripts too. Debian/Ubuntu OS support at 'beta' stage, may work not correct
|
||||
|
||||
# Database support
|
||||
|
||||
|
|
|
@ -438,9 +438,28 @@ def update_db_v_3_5_3(**kwargs):
|
|||
con.close()
|
||||
|
||||
|
||||
def update_db_v_3_8_1(**kwargs):
|
||||
con, cur = get_cur()
|
||||
sql = list()
|
||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_class_search', 'user', 'ldap', 'Class to search user');")
|
||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_user_attribute', 'sAMAccountName', 'ldap', 'User attribute for search');")
|
||||
|
||||
for i in sql:
|
||||
try:
|
||||
cur.execute(i)
|
||||
con.commit()
|
||||
except sqltool.Error as e:
|
||||
pass
|
||||
else:
|
||||
if kwargs.get('silent') != 1:
|
||||
print('DB was update to 3.8.1')
|
||||
return True
|
||||
cur.close()
|
||||
con.close()
|
||||
|
||||
def update_ver(**kwargs):
|
||||
con, cur = get_cur()
|
||||
sql = """update version set version = '3.8.1'; """
|
||||
sql = """update version set version = '3.8.2'; """
|
||||
try:
|
||||
cur.execute(sql)
|
||||
con.commit()
|
||||
|
@ -493,6 +512,7 @@ def update_all():
|
|||
update_db_v_3_4_7()
|
||||
update_db_v_3_4_9_5()
|
||||
update_db_v_3_5_3()
|
||||
update_db_v_3_8_1()
|
||||
update_to_hash()
|
||||
update_ver()
|
||||
|
||||
|
@ -512,6 +532,7 @@ def update_all_silent():
|
|||
update_db_v_3_4_7(silent=1)
|
||||
update_db_v_3_4_9_5(silent=1)
|
||||
update_db_v_3_5_3(silent=1)
|
||||
update_db_v_3_8_1(silent=1)
|
||||
update_to_hash()
|
||||
update_ver()
|
||||
|
||||
|
|
|
@ -68,13 +68,14 @@ 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')
|
||||
|
||||
l = ldap.initialize("ldap://"+server+':'+port)
|
||||
try:
|
||||
l.protocol_version = ldap.VERSION3
|
||||
l.set_option(ldap.OPT_REFERRALS, 0)
|
||||
|
||||
bind = l.simple_bind_s(user, password)
|
||||
bind = l.simple_bind_s(ldap_class_search+'='+user, password)
|
||||
except ldap.INVALID_CREDENTIALS:
|
||||
print("Content-type: text/html\n")
|
||||
print('<center><div class="alert alert-danger">Invalid credentials</div><br /><br />')
|
||||
|
|
|
@ -890,6 +890,8 @@ if form.getvalue('get_ldap_email'):
|
|||
ldap_base = sql.get_setting('ldap_base')
|
||||
domain = sql.get_setting('ldap_domain')
|
||||
ldap_search_field = sql.get_setting('ldap_search_field')
|
||||
ldap_class_search = sql.get_setting('ldap_class_search')
|
||||
ldap_user_attribute = sql.get_setting('ldap_user_attribute')
|
||||
|
||||
l = ldap.initialize("ldap://"+server+':'+port)
|
||||
try:
|
||||
|
@ -898,7 +900,7 @@ if form.getvalue('get_ldap_email'):
|
|||
|
||||
bind = l.simple_bind_s(user, password)
|
||||
|
||||
criteria = "(&(objectClass=user)(sAMAccountName="+username+"))"
|
||||
criteria = "(&(objectClass="+ldap_class_search+")("+ldap_user_attribute+"="+username+"))"
|
||||
attributes = [ldap_search_field]
|
||||
result = l.search_s(ldap_base, ldap.SCOPE_SUBTREE, criteria, attributes)
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
{% if h2 %}
|
||||
<span id='browse_histroy'></span>
|
||||
<ul id='browse_histroy'></ul>
|
||||
{% endif %}
|
||||
{% if role %}
|
||||
{% if role <= 2 %}
|
||||
|
|
|
@ -66,6 +66,11 @@
|
|||
{% if onclick == 'viewLogs()' and serv != '' and viewlogs != '' and viewlogs != 'haproxy-wi.error.log' and viewlogs != 'haproxy-wi.access.log' %}
|
||||
<script>
|
||||
viewLogs()
|
||||
if (window.matchMedia('(max-width: 786px)').matches || window.matchMedia('(max-width: 1024px)').matches || window.matchMedia('(max-width: 667px)').matches) {
|
||||
$( "#viewlogs" ).selectmenu({
|
||||
width: 150
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
You can read the descriptions about all logs <a href="https://haproxy-wi.org/description.py?description=logs" title="Servers description" target="_blank">here</a>
|
||||
|
@ -83,6 +88,11 @@
|
|||
$('#waf').prop('checked', true);
|
||||
{% endif %}
|
||||
showLog()
|
||||
if (window.matchMedia('(max-width: 786px)').matches || window.matchMedia('(max-width: 1024px)').matches || window.matchMedia('(max-width: 667px)').matches) {
|
||||
$( "#serv" ).selectmenu({
|
||||
width: 150
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -970,12 +970,11 @@ function createHistroy() {
|
|||
}
|
||||
catch {
|
||||
var get_history_array = ['login.py', 'login.py','login.py'];
|
||||
Cookies.set('history', JSON.stringify(get_history_array), { expires: 1 });
|
||||
Cookies.set('history', JSON.stringify(get_history_array), { expires: 1, path: '/app' });
|
||||
}
|
||||
}
|
||||
function listHistroy() {
|
||||
var browse_history = JSON.parse(Cookies.get('history'));
|
||||
Cookies.remove('history');
|
||||
var history_link = '';
|
||||
var title = []
|
||||
var link_text = []
|
||||
|
@ -1002,13 +1001,13 @@ function listHistroy() {
|
|||
if (browse_history[i] == link2) {
|
||||
title[i] = $(this).find('a').attr('title');
|
||||
link_text[i] = $(this).find('a').text();
|
||||
history_link = '<a href="'+browse_history[i]+'" title="'+title[i]+'"> > '+link_text[i]+'</a>'
|
||||
history_link = '<li><a href="'+browse_history[i]+'" title="'+title[i]+'">'+link_text[i]+'</a></li>'
|
||||
$('#browse_histroy').append(history_link);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Cookies.set('history', JSON.stringify(browse_history), { expires: 1 });
|
||||
Cookies.set('history', JSON.stringify(browse_history), { expires: 1, path: '/app' });
|
||||
}
|
||||
createHistroy()
|
||||
listHistroy()
|
|
@ -29,16 +29,35 @@ h3 {
|
|||
font-size: 1.6em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
#browse_histroy {
|
||||
ul#browse_histroy {
|
||||
padding-left: 10px;
|
||||
margin-bottom: 5px;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
margin-top: 1px;
|
||||
list-style: none;
|
||||
}
|
||||
#browse_histroy a {
|
||||
font-size: 9.1px;
|
||||
ul#browse_histroy li {
|
||||
display: inline;
|
||||
padding-right: 5px;
|
||||
}
|
||||
ul#browse_histroy li+li:before {
|
||||
content: "\003e";
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
margin-right: 2.5px;
|
||||
}
|
||||
#browse_histroy a {
|
||||
color: #767676;
|
||||
font-size: 9.1px;
|
||||
font-weight: bold;
|
||||
}
|
||||
ul#browse_histroy li:first-child a {
|
||||
font-size: 8.4px;
|
||||
color: #979393;
|
||||
}
|
||||
ul#browse_histroy li:last-child a {
|
||||
font-size: 9.8px;
|
||||
color: #7e7b7b;
|
||||
}
|
||||
form {
|
||||
margin: 0;
|
||||
|
|
Loading…
Reference in New Issue