From 0666d621620985b388f4ae9ab50c7ad8fc0463c6 Mon Sep 17 00:00:00 2001 From: Michael Anstis Date: Mon, 13 May 2024 18:03:27 +0100 Subject: [PATCH] Support Django logout redirects (#15148) * Allowed hosts for logout redirects can now be set via the LOGOUT_ALLOWED_HOSTS setting Authored-by: Michael Anstis Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com> --- awx/api/generics.py | 3 +++ awx/settings/defaults.py | 1 + 2 files changed, 4 insertions(+) diff --git a/awx/api/generics.py b/awx/api/generics.py index c51470c1a414..3118a86a20d5 100644 --- a/awx/api/generics.py +++ b/awx/api/generics.py @@ -109,6 +109,9 @@ def post(self, request, *args, **kwargs): class LoggedLogoutView(auth_views.LogoutView): + + success_url_allowed_hosts = settings.LOGOUT_ALLOWED_HOSTS + def dispatch(self, request, *args, **kwargs): original_user = getattr(request, 'user', None) ret = super(LoggedLogoutView, self).dispatch(request, *args, **kwargs) diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index c82915732371..5e5f8d886fe8 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -114,6 +114,7 @@ MEDIA_URL = '/media/' LOGIN_URL = '/api/login/' +LOGOUT_ALLOWED_HOSTS = [] # Absolute filesystem path to the directory to host projects (with playbooks). # This directory should not be web-accessible.