open-forms
open-forms copied to clipboard
Infinite redirect loop when logging in to the admin via OIDC if you're not a staff user
If the OIDC integration is not configured correctly and the created user is not staff, you end up in an infinite redirect loop from /admin/
-> /admin/login/
-> /admin/
-> ...
This is confusing - we should detect whether the user is staff or not and break this redirect loop + display the relevant message, which Django has on its login page:
{% if user.is_authenticated %}
<p class="errornote">
{% blocktranslate trimmed %}
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktranslate %}
</p>
{% endif %}