Ejemplo n.º 1
0
def not_ROLE(self):
    # This method of LoginManager requires that you provide a `not_ROLE_view` attribute to LoginManager.
    # `not_ROLE_view` can be provided where you provide a `login_view` for unauthorized users.
    not_ROLE_view = self.not_ROLE_view
    config = current_app.config
    if config.get('USE_SESSION_FOR_NEXT', USE_SESSION_FOR_NEXT):
        not_ROLE_url = expand_login_view(not_ROLE_view)
        session['_id'] = self._session_identifier_generator()
        session['next'] = make_next_param(not_ROLE_url, request.url)
        redirect_url = make_login_url(not_ROLE_view)
    else:
        redirect_url = make_login_url(not_ROLE_view, next_url=request.url)
    return redirect(redirect_url)
Ejemplo n.º 2
0
def unauthorized():
    config = get_config()
    if config.get("mode") == "debug":
        abort(401)

    redirect_url = make_login_url("dashboard.login", next_url=request.url)
    return redirect(redirect_url)
Ejemplo n.º 3
0
def unauthorized():
    redirect_url = make_login_url(login.login_view, next_url=request.url)
    return redirect(redirect_url)