Prevent logout loop
This commit is contained in:
parent
b6da973324
commit
1723b80c52
@ -59,7 +59,7 @@
|
||||
<button type="submit" class="btn btn-secondary">{{ provider.name }}</button>
|
||||
</form>
|
||||
</li>
|
||||
{% if REDIRECT_LOGIN_TO_SSO and forloop.counter0 == 0 %}
|
||||
{% if REDIRECT_LOGIN_TO_SSO and forloop.counter0 == 0 and request.GET.loggedout != '1' %}
|
||||
<script type="text/javascript">
|
||||
const form = document.getElementById('social-login');
|
||||
if (form) {
|
||||
|
@ -369,7 +369,10 @@ def _parse_base_paths() -> tuple[str, str, str, str, str]:
|
||||
base_url = (script_name or "") + "/"
|
||||
login_url = base_url + "accounts/login/"
|
||||
login_redirect_url = base_url + "dashboard"
|
||||
logout_redirect_url = os.getenv("PAPERLESS_LOGOUT_REDIRECT_URL", base_url)
|
||||
logout_redirect_url = os.getenv(
|
||||
"PAPERLESS_LOGOUT_REDIRECT_URL",
|
||||
login_url + "?loggedout=1",
|
||||
)
|
||||
return script_name, base_url, login_url, login_redirect_url, logout_redirect_url
|
||||
|
||||
|
||||
|
@ -410,7 +410,10 @@ class TestPathSettings(TestCase):
|
||||
self.assertEqual("/", base_paths[1]) # BASE_URL
|
||||
self.assertEqual("/accounts/login/", base_paths[2]) # LOGIN_URL
|
||||
self.assertEqual("/dashboard", base_paths[3]) # LOGIN_REDIRECT_URL
|
||||
self.assertEqual("/", base_paths[4]) # LOGOUT_REDIRECT_URL
|
||||
self.assertEqual(
|
||||
"/accounts/login/?loggedout=1",
|
||||
base_paths[4],
|
||||
) # LOGOUT_REDIRECT_URL
|
||||
|
||||
@mock.patch("os.environ", {"PAPERLESS_FORCE_SCRIPT_NAME": "/paperless"})
|
||||
def test_subpath(self):
|
||||
@ -427,7 +430,10 @@ class TestPathSettings(TestCase):
|
||||
self.assertEqual("/paperless/", base_paths[1]) # BASE_URL
|
||||
self.assertEqual("/paperless/accounts/login/", base_paths[2]) # LOGIN_URL
|
||||
self.assertEqual("/paperless/dashboard", base_paths[3]) # LOGIN_REDIRECT_URL
|
||||
self.assertEqual("/paperless/", base_paths[4]) # LOGOUT_REDIRECT_URL
|
||||
self.assertEqual(
|
||||
"/paperless/accounts/login/?loggedout=1",
|
||||
base_paths[4],
|
||||
) # LOGOUT_REDIRECT_URL
|
||||
|
||||
@mock.patch(
|
||||
"os.environ",
|
||||
|
Loading…
x
Reference in New Issue
Block a user