1

I have custom routing and a user controller in a module that redirects authenticated users to a private area on a site.

It works fine when users are coming from the login page - redirects them to a dashboard at a custom user page - but I would like users to continue to the page they are requesting if they come to the site from a link.

It is common for users to share links to internal content and they are then having to log in and get to the link from their dashboard which is causing some annoyance.

I have reasonably simple routing for the user page and a controller in my module that redirects users to their userPage. Is their a way to have this not redirect depending on the link they are requesting?

2 Answers 2

2

You mite need to add 'destination' query parameter for shared link.

For example: https://www.drupal.org/user/login?destination=search/site/destinations

2
2

If the pages are giving an access denied message and you want them to login first then it sounds like you might want r4032login

As the project page says:

Redirect the HTTP 403 error page to the Drupal /user/login page with an optional message that reads:

"Access denied! You must login to view this page."

Also, the desired page is appended in the url query string so that, once login is successful, the user is taken directly where they were originally trying to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.