26 lines
1.0 KiB
Python
26 lines
1.0 KiB
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 get_logout_redirect_url, logout_current_user
|
|
from plane.utils.path_validator import get_safe_redirect_url
|
|
|
|
|
|
class SignOutAuthSpaceEndpoint(View):
|
|
def post(self, request):
|
|
next_path = request.POST.get("next_path")
|
|
|
|
try:
|
|
logout_current_user(request)
|
|
url = get_safe_redirect_url(base_url=base_host(request=request, is_space=True), next_path=next_path)
|
|
return HttpResponseRedirect(get_logout_redirect_url(url))
|
|
except Exception:
|
|
url = get_safe_redirect_url(base_url=base_host(request=request, is_space=True), next_path=next_path)
|
|
return HttpResponseRedirect(get_logout_redirect_url(url))
|