From 4d641b6cf5738f76db1b470869defd98d57a80ca 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 c51470c1a4..3118a86a20 100644 --- a/awx/api/generics.py +++ b/awx/api/generics.py @@ -109,6 +109,9 @@ class LoggedLoginView(auth_views.LoginView): 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 c829157323..5e5f8d886f 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -114,6 +114,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'public', 'media') 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.