open-forms icon indicating copy to clipboard operation
open-forms copied to clipboard

Infinite redirect loop when logging in to the admin via OIDC if you're not a staff user

Open sergei-maertens opened this issue 8 months ago • 0 comments

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 %}

sergei-maertens avatar Jun 18 '24 08:06 sergei-maertens