Esempio n. 1
0
def _render_ologin_error(service_name,
                         error_message=None,
                         register_redirect=False):
    """ Returns a Flask response indicating an OAuth error. """

    user_creation = bool(features.USER_CREATION and features.DIRECT_LOGIN
                         and not features.INVITE_ONLY_USER_CREATION)
    error_info = {
        "reason": "ologinerror",
        "service_name": service_name,
        "error_message": error_message
        or "Could not load user data. The token may have expired",
        "service_url": get_app_url(),
        "user_creation": user_creation,
        "register_redirect": register_redirect,
    }

    resp = index("", error_info=error_info)
    resp.status_code = 400
    return resp
Esempio n. 2
0
def _render_ologin_error(service_name,
                         error_message=None,
                         register_redirect=False):
    """ Returns a Flask response indicating an OAuth error. """

    user_creation = bool(features.USER_CREATION and features.DIRECT_LOGIN
                         and not features.INVITE_ONLY_USER_CREATION)
    error_info = {
        'reason': 'ologinerror',
        'service_name': service_name,
        'error_message': error_message
        or 'Could not load user data. The token may have expired',
        'service_url': get_app_url(),
        'user_creation': user_creation,
        'register_redirect': register_redirect,
    }

    resp = index('', error_info=error_info)
    resp.status_code = 400
    return resp