def logout_user(): """Logs out the current user. This will also clean up the remember me cookie if it exists. This sends an ``identity_changed`` signal to note that the current identity is now the `AnonymousIdentity` """ for key in ("identity.name", "identity.auth_type", "fs_paa", "fs_gexp"): session.pop(key, None) # Clear csrf token between sessions. # Ideally this would be handled by Flask-WTF but... # We don't clear entire session since Flask-Login seems to like having it. csrf_field_name = find_csrf_field_name() if csrf_field_name: session.pop(csrf_field_name, None) # Flask-WTF 'caches' csrf_token - and only set the session if not already # in 'g'. Be sure to clear both. This affects at least /confirm g.pop(csrf_field_name, None) session["fs_cc"] = "clear" identity_changed.send( current_app._get_current_object(), identity=AnonymousIdentity() ) _logout_user()
def logout_user(): """Logs out the current. This will also clean up the remember me cookie if it exists.""" for key in ("identity.name", "identity.auth_type"): session.pop(key, None) identity_changed.send(current_app._get_current_object(), identity=AnonymousIdentity()) _logout_user()
def logout_user(): """Logs out the current. This will also clean up the remember me cookie if it exists.""" for key in ('identity.name', 'identity.auth_type'): session.pop(key, None) identity_changed.send(current_app._get_current_object(), identity=AnonymousIdentity()) _logout_user()
def logout_user(db): if current_user.is_authenticated: current_user.active = False db.session.add(current_user) db.session.commit() _logout_user() session.clear()
def logout_user() -> bool: """ Logs a user out. (You do not need to pass the actual user.) This will also clean up the remember me cookie if it exists. """ return _logout_user()