mirror of https://github.com/Aidaho12/haproxy-wi
parent
a44f272cb9
commit
9e3fe7d5a5
|
@ -9,7 +9,7 @@ Support the project
|
||||||
[Demo video](https://www.youtube.com/channel/UCo0lCg24j-H4f0S9kMjp-_w)
|
[Demo video](https://www.youtube.com/channel/UCo0lCg24j-H4f0S9kMjp-_w)
|
||||||
|
|
||||||
# Demo site
|
# Demo site
|
||||||
[Demo site](https://178.57.218.185) Login/password: admin/admin. Server resets every hour.
|
[Demo site](https://demo.haproxy-wi.org) Login/password: admin/admin. Server resets every hour.
|
||||||
|
|
||||||
# Twitter
|
# Twitter
|
||||||
Began to lead a [Twitter](https://twitter.com/haproxy_wi), subscribe! I will write there about all the changes and news
|
Began to lead a [Twitter](https://twitter.com/haproxy_wi), subscribe! I will write there about all the changes and news
|
||||||
|
|
18
app/login.py
18
app/login.py
|
@ -48,6 +48,17 @@ def send_cookie(login):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def ban():
|
||||||
|
c = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||||
|
expires = datetime.datetime.utcnow() + datetime.timedelta(seconds=10)
|
||||||
|
c["ban"] = 1
|
||||||
|
c["ban"]["path"] = "/app/"
|
||||||
|
c["ban"]["expires"] = expires.strftime("%a, %d %b %Y %H:%M:%S GMT")
|
||||||
|
print(c)
|
||||||
|
print("Content-type: text/html\n")
|
||||||
|
print('ban')
|
||||||
|
|
||||||
|
|
||||||
def check_in_ldap(user, password):
|
def check_in_ldap(user, password):
|
||||||
import ldap
|
import ldap
|
||||||
|
|
||||||
|
@ -126,9 +137,12 @@ if login is not None and password is not None:
|
||||||
else:
|
else:
|
||||||
if login in users[1] and password == users[3]:
|
if login in users[1] and password == users[3]:
|
||||||
send_cookie(login)
|
send_cookie(login)
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
print("Content-type: text/html\n")
|
ban()
|
||||||
print('<center><div class="alert alert-danger">Your login or password is incorrect</div><br /><br />')
|
sys.exit()
|
||||||
|
else:
|
||||||
|
ban()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
print("Content-type: text/html\n")
|
print("Content-type: text/html\n")
|
||||||
|
|
||||||
|
|
|
@ -115,9 +115,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="copyright-menu">
|
<div class="copyright-menu">
|
||||||
<a href="https://github.com/aidaho12/haproxy-wi/" title="Github repo" target="_blank" style="color: #fff">HAproxy-WI v3.4.5</a>
|
<a href="https://github.com/aidaho12/haproxy-wi/" title="Github repo" target="_blank" style="color: #fff">HAproxy-WI v3.4.5.1</a>
|
||||||
<br>
|
<br>
|
||||||
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a>
|
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Donate</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,8 +9,16 @@
|
||||||
<label for="login">Login: </label><input type="text" name="login" id="login" required class="form-control"><br /><br />
|
<label for="login">Login: </label><input type="text" name="login" id="login" required class="form-control"><br /><br />
|
||||||
<label for="pass">Pass: </label><input type="password" name="pass" id="pass" required class="form-control"><br /><br />
|
<label for="pass">Pass: </label><input type="password" name="pass" id="pass" required class="form-control"><br /><br />
|
||||||
<input type="hidden" value="{{reff}}" name="ref" id="ref">
|
<input type="hidden" value="{{reff}}" name="ref" id="ref">
|
||||||
<button type="submit" name="Login" value="Enter">Sign Up</button>
|
<button type="submit" name="Login" value="Enter" id="enter">Sign Up</button>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="alert alert-danger" style="display: none;">
|
||||||
|
Your login or password is incorrect
|
||||||
|
<br />
|
||||||
|
<span id="ban_10">
|
||||||
|
<br />
|
||||||
|
You can try again in <span id="ban_timer">10</span> seconds
|
||||||
|
</span>
|
||||||
|
</div><br /><br />
|
||||||
</center>
|
</center>
|
||||||
<div id="dialog-confirm" title="View certificate " style="display: none;">
|
<div id="dialog-confirm" title="View certificate " style="display: none;">
|
||||||
<center>
|
<center>
|
||||||
|
|
|
@ -441,10 +441,6 @@ $( function() {
|
||||||
theme:"minimal-dark",
|
theme:"minimal-dark",
|
||||||
scrollInertia:30
|
scrollInertia:30
|
||||||
});
|
});
|
||||||
/*$(".top-link").mCustomScrollbar({
|
|
||||||
theme:"minimal-dark",
|
|
||||||
scrollInertia:30
|
|
||||||
}); */
|
|
||||||
$(".diff").mCustomScrollbar({
|
$(".diff").mCustomScrollbar({
|
||||||
theme:"minimal-dark",
|
theme:"minimal-dark",
|
||||||
scrollInertia:30
|
scrollInertia:30
|
||||||
|
@ -1322,7 +1318,7 @@ $( function() {
|
||||||
$('.advance').fadeIn();
|
$('.advance').fadeIn();
|
||||||
});
|
});
|
||||||
$('#auth').submit(function() {
|
$('#auth').submit(function() {
|
||||||
$('.alert-danger').remove();
|
|
||||||
let searchParams = new URLSearchParams(window.location.search)
|
let searchParams = new URLSearchParams(window.location.search)
|
||||||
if(searchParams.has('ref')) {
|
if(searchParams.has('ref')) {
|
||||||
var ref = searchParams.get('ref');
|
var ref = searchParams.get('ref');
|
||||||
|
@ -1339,15 +1335,37 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('ok') != '-1') {
|
if (data.indexOf('ok') != '-1') {
|
||||||
window.location.replace(ref);
|
window.location.replace(ref);
|
||||||
} else {
|
} else if (data.indexOf('ban') != '-1') {
|
||||||
$('.alert-danger').remove();
|
ban();
|
||||||
$("#ajax").html(data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
function sleep(ms) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
async function ban() {
|
||||||
|
$( '#login').attr('disabled', 'disabled');
|
||||||
|
$( '#pass').attr('disabled', 'disabled');
|
||||||
|
$( "input[type=submit], button" ).button('disable');
|
||||||
|
$('.alert').show();
|
||||||
|
$('#ban_10').show();
|
||||||
|
$( '#ban_timer').text(10);
|
||||||
|
|
||||||
|
let i = 10;
|
||||||
|
while (i > 0) {
|
||||||
|
i--;
|
||||||
|
await sleep(1000);
|
||||||
|
$( '#ban_timer').text(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
$( '#login').removeAttr('disabled');
|
||||||
|
$( '#pass').removeAttr('disabled');
|
||||||
|
$( "input[type=submit], button" ).button('enable');
|
||||||
|
$('#ban_10').hide();
|
||||||
|
}
|
||||||
function change_select_acceleration(id) {
|
function change_select_acceleration(id) {
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
|
|
Loading…
Reference in New Issue