def auth_logout(): """ Method to log out from the application. """ if not flask.g.fas_user: return flask.redirect(flask.url_for("index")) FAS.logout() flask.flash("You have been logged out") return flask.redirect(flask.url_for("index"))
def auth_logout(): """ Method to log out from the application. """ if not authenticated(): return flask.redirect(flask.url_for('index')) FAS.logout() flask.flash('You have been logged out') return flask.redirect(flask.url_for('index'))
def auth_logout(): """ Method to log out from the application. """ if not authenticated(): return flask.redirect(flask.url_for('index')) FAS.logout() flask.flash('You have been logged out') return flask.redirect(flask.url_for('index'))
def logout(): auth = APP.config.get('PAGURE_AUTH', None) if auth in ['fas', 'openid']: if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() elif auth == 'local': import pagure.ui.login as login login.logout()
def logout(): auth = APP.config.get('PAGURE_AUTH', None) if auth in ['fas', 'openid']: if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() elif auth == 'local': import pagure.ui.login as login login.logout()
def logout(): auth = APP.config.get("PAGURE_AUTH", None) if auth in ["fas", "openid"]: if hasattr(flask.g, "fas_user") and flask.g.fas_user is not None: FAS.logout() elif auth == "local": import pagure.ui.login as login login.logout()
def auth_logout(): """ Log out if the user is logged in other do nothing. Return to the index page at the end. """ next_url = flask.url_for('index') if APP.config.get('MM_AUTHENTICATION', None) == 'fas': if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() flask.flash("You are no longer logged-in") elif APP.config.get('MM_AUTHENTICATION', None) == 'local': login.logout() return flask.redirect(next_url)
def auth_logout(): """ Log out if the user is logged in other do nothing. Return to the index page at the end. """ next_url = flask.url_for('index') if APP.config.get('MM_AUTHENTICATION', None) == 'fas': if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() flask.flash("You are no longer logged-in") elif APP.config.get('MM_AUTHENTICATION', None) == 'local': login.logout() return flask.redirect(next_url)
def admin_session_timedout(): ''' Check if the current user has been authenticated for more than what is allowed (defaults to 15 minutes). If it is the case, the user is logged out and the method returns True, otherwise it returns False. ''' timedout = False if not authenticated(): return True if (datetime.datetime.utcnow() - flask.g.fas_user.login_time) > \ APP.config.get('ADMIN_SESSION_LIFETIME', datetime.timedelta(minutes=15)): timedout = True FAS.logout() return timedout
def logout(): # pragma: no cover ''' Log out if the user is logged in other do nothing. Return to the index page at the end. ''' next_url = None if 'next' in flask.request.args: if is_safe_url(flask.request.args['next']): next_url = flask.request.args['next'] if not next_url or next_url == flask.url_for('.login'): next_url = flask.url_for('.index') if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() flask.flash('You are no longer logged-in') return flask.redirect(next_url)
def logout(): # pragma: no cover ''' Log out if the user is logged in other do nothing. Return to the index page at the end. ''' next_url = None if 'next' in flask.request.args: if is_safe_url(flask.request.args['next']): next_url = flask.request.args['next'] if not next_url or next_url == flask.url_for('.login'): next_url = flask.url_for('.index') if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() flask.flash('You are no longer logged-in') return flask.redirect(next_url)
def auth_logout(): # pragma: no cover """ Method to log out from the application. """ return_point = flask.url_for('index') if 'next' in flask.request.args: if is_safe_url(flask.request.args['next']): return_point = flask.request.args['next'] if not authenticated(): return flask.redirect(return_point) if APP.config.get('PAGURE_AUTH', None) == 'fas': if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() flask.flash("You are no longer logged-in") elif APP.config.get('PAGURE_AUTH', None) == 'local': login.logout() return flask.redirect(return_point)
def admin_session_timedout(): ''' Check if the current user has been authenticated for more than what is allowed (defaults to 15 minutes). If it is the case, the user is logged out and the method returns True, otherwise it returns False. ''' timedout = False if not authenticated(): return True login_time = flask.g.fas_user.login_time # This is because flask_fas_openid will store this as a posix timestamp if not isinstance(login_time, datetime.datetime): login_time = datetime.datetime.utcfromtimestamp(login_time) if (datetime.datetime.utcnow() - login_time) > \ APP.config.get('ADMIN_SESSION_LIFETIME', datetime.timedelta(minutes=15)): timedout = True FAS.logout() return timedout
def auth_logout(): if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() flask.g.fas_user = None flask.flash('You have been logged out') return safe_redirect_back()
def auth_logout(): if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None: FAS.logout() flask.g.fas_user = None flask.flash('You have been logged out') return safe_redirect_back()