This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/core/views/authentication.py

22 lines
748 B
Python
Raw Normal View History

"""passbook core authentication views"""
2018-11-11 12:41:48 +00:00
from django.contrib import messages
2020-05-10 22:49:48 +00:00
from django.contrib.auth import logout
from django.contrib.auth.mixins import LoginRequiredMixin
2018-11-11 12:41:48 +00:00
from django.http import HttpRequest, HttpResponse
2020-05-10 22:49:48 +00:00
from django.shortcuts import redirect, reverse
2018-11-11 12:41:48 +00:00
from django.utils.translation import ugettext as _
2018-11-23 08:44:30 +00:00
from django.views import View
2019-10-01 08:24:10 +00:00
from structlog import get_logger
2018-11-11 12:41:48 +00:00
LOGGER = get_logger()
2018-11-11 12:41:48 +00:00
2018-11-23 08:44:30 +00:00
class LogoutView(LoginRequiredMixin, View):
"""Log current user out"""
def dispatch(self, request: HttpRequest) -> HttpResponse:
2018-11-23 08:44:30 +00:00
"""Log current user out"""
logout(request)
messages.success(request, _("You've successfully been logged out."))
2020-05-10 22:49:48 +00:00
return redirect(reverse("passbook_flows:default-auth"))