Ejemplo n.º 1
0
def logout(request, login_url=None, **kwargs):
    """Logs out the user if he is logged in. Then redirects to the log-in page.

    :param login_url:
        Once logged out, defines the URL where to redirect after login

    :param kwargs:
        see django.contrib.auth.views.logout_then_login extra parameters.

    """
    msg = 'Logging out user "%(username)s".' % \
        {'username': request.user.username}
    LOG.info(msg)
    """ Securely logs a user out. """
    if (settings.WEBSSO_ENABLED and settings.WEBSSO_DEFAULT_REDIRECT
            and settings.WEBSSO_DEFAULT_REDIRECT_LOGOUT):
        auth_user.unset_session_user_variables(request)
        return django_http.HttpResponseRedirect(
            settings.WEBSSO_DEFAULT_REDIRECT_LOGOUT)

    return django_auth_views.logout_then_login(request,
                                               login_url=login_url,
                                               **kwargs)
Ejemplo n.º 2
0
def logout(request, login_url=None, **kwargs):
    """Logs out the user if he is logged in. Then redirects to the log-in page.

    :param login_url:
        Once logged out, defines the URL where to redirect after login

    :param kwargs:
        see django.contrib.auth.views.logout_then_login extra parameters.

    """
    msg = 'Logging out user "%(username)s".' % \
        {'username': request.user.username}
    LOG.info(msg)
    """ Securely logs a user out. """
    if (utils.is_websso_enabled and utils.is_websso_default_redirect()
            and utils.get_websso_default_redirect_logout()):
        auth_user.unset_session_user_variables(request)
        return django_http.HttpResponseRedirect(
            utils.get_websso_default_redirect_logout())
    else:
        return django_auth_views.logout_then_login(request,
                                                   login_url=login_url,
                                                   **kwargs)
Ejemplo n.º 3
0
def logout(request, login_url=None, **kwargs):
    """Logs out the user if he is logged in. Then redirects to the log-in page.

    :param login_url:
        Once logged out, defines the URL where to redirect after login

    :param kwargs:
        see django.contrib.auth.views.logout_then_login extra parameters.

    """
    msg = 'Logging out user "%(username)s".' % \
        {'username': request.user.username}
    LOG.info(msg)

    """ Securely logs a user out. """
    if (utils.is_websso_enabled and utils.is_websso_default_redirect() and
            utils.get_websso_default_redirect_logout()):
        auth_user.unset_session_user_variables(request)
        return django_http.HttpResponseRedirect(
            utils.get_websso_default_redirect_logout())
    else:
        return django_auth_views.logout_then_login(request,
                                                   login_url=login_url,
                                                   **kwargs)