Dashboard should not force redirect on password reset or override other redirects

Created on 6 August 2024, 4 months ago

Problem/Motivation

The forced redirect on login is very naive, always occurs, and cannot be adjusted from the UI.

When a user requests a password reset, they are logged in then force-redirected to the dashboard if there is one available for them. This makes resetting their password much more difficult.

If a login redirect module like Login Destination is in use, dashboard module's redirect will override that module's redirect.

Steps to reproduce

  1. Setup a dashboard to be available for a user of a given role.
  2. Request a password reset as that user.
  3. Follow the link in the email and submit the form.

Expected behaviour: the user should be presented with a password reset form.
Actual behaviour: the user is redirected to the dashboard.

Proposed resolution

  1. Do not ever redirect from the password reset login.
  2. Provide a configuration setting to opt out of the forced redirect so other login redirect modules can be used.
๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand john pitcairn

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

Merge Requests

Comments & Activities

  • Issue created by @john pitcairn
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States thejimbirch Cape Cod, Massachusetts

    Some folks are using the ECA module to create custom login workflows.

    Here is an excellent example in the feature demo.

    https://ecaguide.org/library/use%20case/eca_feature_demo/

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand john pitcairn

    That's not the point. There are many ways to create login redirects. This module shouldn't blindly override those, especially if it's from a password reset.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States thejimbirch Cape Cod, Massachusetts

    Oh, I agree with you John! Just adding an additional way that people are currently using for login redirection.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States thejimbirch Cape Cod, Massachusetts

    I am running into this working on the Drupal CMS SEO recipe. I am creating an SEO dashboard, and because I am using this module, now all users that login get redirected to the dashboard.

    John's proposed resolutions are good. An alternate solution would be to remove all redirection from this module and let other solutions handle that workflow.

    Adding Starshot blocker tag.

  • Merge request !14Removes login redirection functionality โ†’ (Closed) created by thejimbirch
  • Pipeline finished with Failed
    3 months ago
    Total: 208s
    #264073
  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States thejimbirch Cape Cod, Massachusetts

    I created a merge request that removes the redirection completely. For my use case/testing, it appears to be working as expected with no errors or warnings logged.

    There are PHPstan errors and failed tests in the pipeline, but I believe they are unrelated.

  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain plopesc Valladolid

    The aim of Dashboard module is to provide a better experience for users right after login.

    Agree that current implementation could be too aggressive, and alternatives could be discussed.

    However, I believe that removing it completely is too much.

    Being tagged as a Starshot blocker, we have to take care of it somehow.

    Could you please explain your specific needs to try to find a better way to handle login redirects?

    Maybe a setting to toggle redirect could be enough for the problematic scenario.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand john pitcairn
    1. Users who have requested a password reset should not be redirected to a dashboard before they are able to set a new password.
    2. If another login redirect is present, eg from Login Redirect module, or configured via an ECA rule, dashboard should not override that.

    Item 2 could possibly be met by a simple enable/disable checkbox. Item 1 cannot.

    My recommendation would be that if redirection is desired, starshot should use a dedicated configurable login redirect module or ECA rule. We should not rely on a simplistic solution here, it will only wind up needing special case logic that is already solved in contrib. Redirect should be out of scope for this module.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain plopesc Valladolid

    Totally agree that 1 has to be addressed.

    My concern was that MR approach to solve the bug was removing one of the main module features.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States thejimbirch Cape Cod, Massachusetts

    I am proposing that redirection shouldn't be "one of the main module features". In a composable ecosystem such as Drupal you can rely on the many existing solutions to handle the redirection, and concentrate on the other dashboard features.

    ECA is already in Drupal CMS. You could lower the amount of code you have to manage by including an ECA config that handles the redirection. Then it could be turned off or altered by the site owner.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ

    @thejimbirch The idea of this module is eventually become part of core, and IMHO the default experience when you log in into drupal core is the raison d'etre of the issue in the ideas queue that ended up being the initiative where this originated.

    I'm of course open to allow people creating alternatives, but don't think we should rely on any other module for this, or even a setting. AFAIK now it would be possible to intercept this with hook_module_implements_alter. So unless we are preventing ECA or other modules to prevent our redirect, I think this is a won't fix (aside of the reset password form, which is definitely a bug)

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand john pitcairn

    So every contrib or custom module or ECA rule or whatever that redirects at login may be broken as soon as dashboard is installed. And all those implementations will have to add implements_alter() code to fix it.

    Aren't we aiming to be a lower-code platform? How is somebody who just uses an ECA rule via the UI supposed to deal with this?

    Its hard to know what's out there in the wild that will be disrupted - I think this really does need to be controlled by a setting in the UI.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand john pitcairn

    ECA is already in Drupal CMS. You could lower the amount of code you have to manage by including an ECA config that handles the redirection. Then it could be turned off or altered by the site owner.

    Yes, exactly. Why do we need to handle redirect here at all if it can be done better elsewhere in core, and at the same time introduce people to the power of ECA?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    samit.310@gmail.com โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    2 months ago
    Total: 233s
    #287970
  • Status changed to Needs review 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    Hello,

    I have fixed the failed phpunit test cases, Please review.

    Thanks
    Samit K.

  • Status changed to Active 2 months ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ

    This is still under discussion.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ

    We discussed this at DrupalCon with @timplunket and @pameeela.

    We agreed that redirecting to the dashboard on login is something that we should do.

    We agreed that we should respect any destination argument and NOT redirect in that case.
    I think that should solve the password reset form issue too, but in any case we want specific test coverage for that usecase.

    Thanks everyone for raising up this concern.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States thejimbirch Cape Cod, Massachusetts

    Redirect to the dashboard after login was added to Drupal CMS yesterday using ECA.

    https://www.drupal.org/project/drupal_cms/issues/3477300 ๐Ÿ“Œ Create recipe for certain technical redirects with ECA Active

  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ

    That doesn't change that this still needs to happen here. We can reuse some of the test code from there, thanks!

  • ๐Ÿ‡ช๐Ÿ‡ธSpain plopesc Valladolid

    Created new MR !27 adding exceptions for destination query parameter and one time login links.

    It has been interesting because in order to make test compatible with both D10 & D11, we had to add some tricky logic due to โœจ Use one-time login link instead of user login form in BrowserTestBase tests Fixed .

    Hope once this is merged the Drupal CMS repository could rely on these redirects instead of custom ones.

    Thank you!

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany jurgenhaas Gottmadingen

    I think the MR !14 is the correct one here as it removes the redirect by the dashboard module entirely. Redirects are now managed by ECA and there's no need for something in here at all. If this module wants to keep the redirect feature for outside Starshot usage, then it should probably be configurable so that it can be turned off in Starshot.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mtift Minnesota, USA

    This looks like the correct approach to me, too. Thanks, @plopesc!

  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ

    penyaskito โ†’ changed the visibility of the branch 3466196-remove-redirect to hidden.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ

    Fixed ๐Ÿ“Œ Fix phpcs issues in gitlabCI Active and rebased with it, so phpcs checks will pass.

  • Pipeline finished with Skipped
    about 2 months ago
    #305331
  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 4 days ago
Production build 0.71.5 2024