Beispiel #1
0
def signout(request,
            next_page=userena_settings.USERENA_REDIRECT_ON_SIGNOUT,
            template_name='userena/signout.html',
            *args,
            **kwargs):
    """
    Signs out the user and adds a success message ``You have been signed
    out.`` If next_page is defined you will be redirected to the URI. If
    not the template in template_name is used.

    :param next_page:
        A string which specifies the URI to redirect to.

    :param template_name:
        String defining the name of the template to use. Defaults to
        ``userena/signout.html``.

    """
    if request.user.is_authenticated(
    ) and userena_settings.USERENA_USE_MESSAGES:  # pragma: no cover
        messages.success(request,
                         _('You have been signed out.'),
                         fail_silently=True)
    userena_signals.account_signout.send(sender=None, user=request.user)
    return Signout(request, next_page, template_name, *args, **kwargs)
def signout(request, next_page=userena_settings.USERENA_REDIRECT_ON_SIGNOUT,
            template_name='userena/signout.html', *args, **kwargs):
    if request.user.is_authenticated() and userena_settings.USERENA_USE_MESSAGES: # pragma: no cover
        messages.success(request, _('You have been signed out.'), fail_silently=True)
    userena_signals.account_signout.send(sender=None, user=request.user)
    return Signout(request, next_page, template_name, *args, **kwargs)