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 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
|
||||
Began to lead a [Twitter](https://twitter.com/haproxy_wi), subscribe! I will write there about all the changes and news
|
||||
|
|
20
app/login.py
20
app/login.py
|
@ -47,7 +47,18 @@ def send_cookie(login):
|
|||
print('ok')
|
||||
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):
|
||||
import ldap
|
||||
|
||||
|
@ -126,10 +137,13 @@ if login is not None and password is not None:
|
|||
else:
|
||||
if login in users[1] and password == users[3]:
|
||||
send_cookie(login)
|
||||
break
|
||||
else:
|
||||
print("Content-type: text/html\n")
|
||||
print('<center><div class="alert alert-danger">Your login or password is incorrect</div><br /><br />')
|
||||
ban()
|
||||
sys.exit()
|
||||
else:
|
||||
ban()
|
||||
sys.exit()
|
||||
print("Content-type: text/html\n")
|
||||
|
||||
if login is None:
|
||||
|
|
|
@ -115,9 +115,9 @@
|
|||
</ul>
|
||||
</nav>
|
||||
<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>
|
||||
<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>
|
||||
|
@ -217,4 +217,4 @@
|
|||
<div id="ajax"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -9,8 +9,16 @@
|
|||
<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 />
|
||||
<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>
|
||||
<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>
|
||||
<div id="dialog-confirm" title="View certificate " style="display: none;">
|
||||
<center>
|
||||
|
|
|
@ -441,10 +441,6 @@ $( function() {
|
|||
theme:"minimal-dark",
|
||||
scrollInertia:30
|
||||
});
|
||||
/*$(".top-link").mCustomScrollbar({
|
||||
theme:"minimal-dark",
|
||||
scrollInertia:30
|
||||
}); */
|
||||
$(".diff").mCustomScrollbar({
|
||||
theme:"minimal-dark",
|
||||
scrollInertia:30
|
||||
|
@ -1322,7 +1318,7 @@ $( function() {
|
|||
$('.advance').fadeIn();
|
||||
});
|
||||
$('#auth').submit(function() {
|
||||
$('.alert-danger').remove();
|
||||
|
||||
let searchParams = new URLSearchParams(window.location.search)
|
||||
if(searchParams.has('ref')) {
|
||||
var ref = searchParams.get('ref');
|
||||
|
@ -1339,15 +1335,37 @@ $( function() {
|
|||
success: function( data ) {
|
||||
if (data.indexOf('ok') != '-1') {
|
||||
window.location.replace(ref);
|
||||
} else {
|
||||
$('.alert-danger').remove();
|
||||
$("#ajax").html(data);
|
||||
} else if (data.indexOf('ban') != '-1') {
|
||||
ban();
|
||||
}
|
||||
}
|
||||
} );
|
||||
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) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
|
|
Loading…
Reference in New Issue