Problem/Motivation

If login form is enabled for anonymous users, and the user logs in, the user should be redirected to the page they originally tried to access. This does to happen.

Steps to reproduce

  1. Set up the module to have the login form is enabled for anonymous users.
  2. As the anonymous user, try to access the /admin area.
  3. Log in as an administrator.
  4. Observe that no redirection takes place.

Proposed resolution

Examine function _customerror_login_submit() in customerror.module to find out what goes wrong.

Fix it.

Command icon 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

gisle created an issue. See original summary.

dhruv.mittal’s picture

Assigned: Unassigned » dhruv.mittal

Working on it

dhruv.mittal’s picture

Assigned: dhruv.mittal » Unassigned
Status: Active » Needs review

I have raised an MR , Kindly do check

tirupati_singh’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new498.97 KB
new123.02 KB
new188.57 KB
new705.25 KB

Hi @dhruv.mittal, I've applied the provided MR as a patch and it applied cleanly without any errors. After applying the patch, when the anonymous user tries to access the admin page getting Access Denied along with the login form as configured through the module configuration. After logging, the user is redirected to the hit URL only. I'm attaching the video clips of the before and after fixes for reference. Moving the issue status to RTBC as the MR is resolving the issue.

Thanks!

mlncn’s picture

Status: Reviewed & tested by the community » Fixed

Definitely looks like an improvement/fix for the current code; still feels like we should find a way to not have to do this at all but that would be a major refactor of the module probably with less functionality, to have our message at the not found URL rather than at our own path. Merge request approved.

  • mlncn committed 31f1fba2 on 8.x-1.x
    Issue #3401346 by dhruv.mittal, tirupati_singh, gisle, mlncn: Redirect...
mlncn’s picture

(the merge request refused to merge due to test failures unrelated to the changes here, so patched local code and pushed)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.