Fix kick bug

This commit is contained in:
Jeremy Zhang 2017-04-05 20:18:07 -07:00
parent 347f001993
commit 8a382e8dae
2 changed files with 12 additions and 7 deletions

View File

@ -65,6 +65,7 @@ def update_user_status(guild_id, username, user_key=None):
'revoked': checkUserRevoke(guild_id, user_key), 'revoked': checkUserRevoke(guild_id, user_key),
} }
if status['banned'] or status['revoked']: if status['banned'] or status['revoked']:
session['user_keys'].pop(guild_id, None)
return status return status
dbUser = UnauthenticatedUsers.query.filter(and_(UnauthenticatedUsers.guild_id == guild_id, UnauthenticatedUsers.user_key == user_key)).first() dbUser = UnauthenticatedUsers.query.filter(and_(UnauthenticatedUsers.guild_id == guild_id, UnauthenticatedUsers.user_key == user_key)).first()
dbUser.bumpTimestamp() dbUser.bumpTimestamp()

View File

@ -299,14 +299,16 @@ function run_fetch_routine() {
fet.fail(function(data) { fet.fail(function(data) {
if (data.status == 403) { if (data.status == 403) {
$('#loginmodal').modal('open'); $('#loginmodal').modal('open');
Materialize.toast('Authentication error! You have been banned.', 10000); Materialize.toast('Authentication error! You have been disconnected by the server.', 10000);
} else if (data.status == 401) { } else if (data.status == 401) {
$('#loginmodal').modal('open'); $('#loginmodal').modal('open');
Materialize.toast('Session expired! You have been logged out.', 10000); Materialize.toast('Session expired! You have been logged out.', 10000);
} }
}); });
fet.catch(function(data) { fet.catch(function(data) {
fetchtimeout = setTimeout(run_fetch_routine, 10000); if (data.status != 403) {
fetchtimeout = setTimeout(run_fetch_routine, 10000);
}
}); });
} }
@ -335,7 +337,9 @@ $("#custom_username_field").keyup(function(event){
initialize_embed(); initialize_embed();
}); });
usr.fail(function(data) { usr.fail(function(data) {
if (data.status == 403) { if (data.status == 429) {
Materialize.toast('Sorry! You are allowed to log in as a guest once every 15 minutes.', 10000);
} else if (data.status == 403) {
Materialize.toast('Authentication error! You have been banned.', 10000); Materialize.toast('Authentication error! You have been banned.', 10000);
} }
}) })