NODEDC_TASKMANAGER/plane-src/apps/api/plane/authentication/views/app/signout.py

24 lines
798 B
Python

# Copyright (c) 2023-present Plane Software, Inc. and contributors
# SPDX-License-Identifier: AGPL-3.0-only
# See the LICENSE file for details.
# Django imports
from django.views import View
from django.http import HttpResponseRedirect
# Module imports
from plane.authentication.utils.host import base_host
from plane.authentication.views.nodedc_logout import clear_nodedc_auth_cookies, get_logout_redirect_url, logout_current_user
class SignOutAuthEndpoint(View):
def post(self, request):
redirect_url = get_logout_redirect_url(base_host(request=request, is_app=True))
try:
logout_current_user(request)
except Exception:
pass
response = HttpResponseRedirect(redirect_url)
return clear_nodedc_auth_cookies(response, request)