Allow defining default URL destination after logging in

Created on 5 June 2023, over 1 year ago
Updated 8 June 2023, over 1 year ago

Problem/Motivation

Most of the time, an admin user will have little use in seeing their own user account page with the message "Status message - You are already logged in." after drush uli.

Wouldn't it be great to be able to define a preferred URL destination instead, for that situation?

Steps to reproduce

Run drush uli and see the message "Status message - You are already logged in." on /user/1/edit?pass-reset-token=Ol8[...]jhw&check_logged_in=1.

Realize that another URL would have been more useful.

Proposed resolution

  1. Provide a form, maybe under /admin/config/development/uli_workflow called "ULI Workflow"? ("ULI Custom Workflow" seems a bit too long ...)
  2. Allow defining a more useful URL destination, such as <front> for front page, /category if you're working on a Category View with that URL, or /node/add, or /admin/reports/updates, etc.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇩🇰Denmark ressa Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ressa
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sakthi_dev

    Created a patch. Please review.

  • 🇩🇰Denmark ressa Copenhagen

    Thanks! But perhaps shouldn't there be a configuration form to define this? I'll add this to the

  • Status changed to Needs work over 1 year ago
  • 🇩🇰Denmark ressa Copenhagen
  • 🇨🇦Canada alberto56

    I'll change the title because what we want here is a "default" URL. (The default is currently the user page).

    This should not be confounded with the possibility, currently available, of defining a destination, by appending ?destination=/admin/index, for example, to the URL.

    For example, this can be added to the "forgot my password" messages at /admin/config/people/accounts

    We can also do this in drush like this:

    echo $(drush uli)?destination=/admin/index

    Right now, if there is no "destination" parameter, we display the user page.

    I didn't test the patch, but looking at the patch, it seems that the login form would redirect even if we're not using the ULI (even if we're logging in with our username and password). If that is the case, this would be outside the scope of this module.

  • Status changed to Active over 1 year ago
  • 🇩🇰Denmark ressa Copenhagen

    Thanks for making the title more precise @alberto56, and also for the tip about appending a destination. This works well in Linux, to also open it in the browser: xdg-open $(drush uli)?destination=/categories.

    But before we actually build a solution, we should probably discuss if it's a good idea or not, now that we have the appending a URL parameter as a possible workaround.

    What speaks for having it as a setting, is that different projects can have different default URLs, so you don't have to constantly make sure you're firing off xdg-open $(drush uli)?destination=/categories and not xdg-open $(drush uli)?destination=/node/add, in two different projects, with different needs.

    xdg-open $(drush uli) would be enough.

    Thinking more about it, it should probably be a per user setting ... and then it maybe is too much work for too little gain ... what do you think? I'd be ready to close it as working as designed.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇨🇦Canada alberto56

    Interesting. I think it probably is about whoever crafts the ULI to determine what landing page they want and append "?destination=xxx" to the ULI. Because this is already a core functionality, it's probably best not to not reproduce it here.

    For example, I maintain a module which provides links on a source website to allow access to a destination website, logging the user in if they are not already logged in. In that module I plan in https://www.drupal.org/project/multiaccess/issues/3364969 Allow propagating the "destination" parameter to destination sites Fixed to leverage the "destination" parameter to allow redirecting users to a given path, and logging them if they're not already logged in.

    Similarly, the https://www.drupal.org/project/one_time_login_link_admin allows admins to provide other users with a ULI. Currently that ULI is not customizable with a "destination" parameter but that would be a nice feature.

    Another reason for having the destination managed by whoever creates the link is that, then, they will no longer be dependent on this module to have the functionality of redirecting the user to a specific page; because it is a core feature.

    Based on the above, and the previous comment, I will close this as works as designed. Thanks!

  • 🇩🇰Denmark ressa Copenhagen

    Yes, it's probably best to leave the destination in the hands of core, I agree.

    We can always revisit this issue, when ULI Custom Workflow gets included in core, and then add the functionality :)

Production build 0.71.5 2024