Problem/Motivation
I find it somewhat confusing for authenticated users to be redirected without a message. It would be nice to have a configurable message shown to authenticated users as well as anonymous users.
Steps to reproduce
1. Be authenticated as a user that is not an admin
2. Visit /admin
3. Be redirected without message, and wonder why.
Proposed resolution
Allow admins to show a message similar to what anonymous users see.
Remaining tasks
User interface changes
3 new settings:
* Display access denied message on authenticated landing page
* Authenticated user 'access denied' message
* Authenticated user 'access denied' message type
API changes
None.
Data model changes
Just the new configuration.
Issue fork r4032login-3201471
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
gregglesOK, this needs review.
Comment #4
lkacenjaWe reviewed the code and tested the patch on the Foundation's staging server. Works as advertised. Thanks!
Comment #5
gregglesJust fixing a typo on the title.
Comment #6
nixou commentedThanks you for the new feature.
This will be merged to the 2.x branch which has to remain compatible with both D8 and D9.
The patch is not passing tests due to the usage of drupal_set_message() which do not exists anymore on D9.
We should also considere to have HTML in the authenticated message as we have for the anonymous one.
Moreover it would be good to have a functional test for this new functionality.
So remaining tasks should be :
Comment #7
lkacenjaI updated the work in #5 to be D9 ready. I also added the requested test.
I hit one unanticipated snag. Since the feature branch was originally created, something with the destination handling changed. When I setup a redirect for authenticated users, I got an infinite set of redirections due to the destination param being set. For instance if authenticated users are were set to be redirected to '/', when I visited '/admin/config' then I'd be redirected to '/?destination=/admin/config'. When the destination is processed, the whole thing starts over again. I attempted to fix this by unsetting the destination for logged in users for redirection happening on the site. Here is that change. Happy to remove this if it could be dealt with in a better way. Thanks!
Comment #8
lkacenjaComment #9
gregglesAny feedback from a maintainer on this? I worked on the initial version, but it's been working well on a D9 site for a while. Would be great if a maintainer could review the current work and test it out.
Comment #11
nixou commentedThank you very much.
I just added some additionnal test and I reorganized the settings form for a better lisibility.
Committed to 2.x-dev, will be released in 2.1.1.