diff --git a/participate.py b/participate.py index 8c01d1b..96ec376 100755 --- a/participate.py +++ b/participate.py @@ -534,7 +534,8 @@ def save_staff_slot(turn_id, slot_id, user_id): return False if commit != None: return False - return True + return True + return False def get_roles(): """ Get full roles list """ @@ -542,7 +543,7 @@ def get_roles(): roles = Tetawebapp_roles.query.filter(Tetawebapp_roles.id > 3).all() return roles except Exception as e: - print "[+] Error at get_staffs:" + print "[+] Error at get_roles:" print "------------------------------" print "%s" % e.message print "------------------------------" @@ -1132,7 +1133,7 @@ def clear_staff_slot(TURN_ID, SLOT_ID): user_id = session['user_id'] if (drop_staff_slot(turn_id, slot_id, user_id)): return " " - return "Erreur" + return "KO" except AttributeError: # User is not logged in return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide") @@ -1151,7 +1152,7 @@ def update_staff_slot(TURN_ID, SLOT_ID): if user_name != None: if (save_staff_slot(turn_id, slot_id, user_id)): return user_name - return "Erreur" + return "KO" except AttributeError as e: # User is not logged in print e diff --git a/static/scripts/tetawebapp.js b/static/scripts/tetawebapp.js index e6ffbea..0cff5da 100644 --- a/static/scripts/tetawebapp.js +++ b/static/scripts/tetawebapp.js @@ -137,6 +137,9 @@ function get_html_from_ajax(obj, url) { xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { var response = xhttp.responseText; + if (response == "KO"){ + document.location.reload(true); + } obj.innerHTML = response; } };