Problem/Motivation

We have /user/login set as our 403 path. The form looks a bit broken because the frontend theme is used and not the admin theme.

The route name check is broken since the route name matches the main request, not the subrequest. Not sure if this is possible but raising :)

Steps to reproduce

system.site with

page:
  403: /user/login

go to a 403 page

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork gin_login-3508338

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

mglaman created an issue. See original summary.

pameeela’s picture

We've hit this in the first Drupal CMS template, just realised I should check whether it's a gin_login issue :)

jwilson3’s picture

Is this the same (or similar) issue as #3547364: Stylesheet missing on /user/register when 403? The steps to reproduce sound quite different, but maybe the MR I wrote there would work to solve this issue too? Please check! Thanks.

jwilson3’s picture

I just tested on Gin Login 2.1.x branch with a clean standard Drupal 11 install (via ddev-drupal-contrib), but was unable to reproduce the issue. I also sanity checked same behavior on MR 48 for aforementioned issue #3547364, and saw no adverse impact.

Maybe this is something specific to do with Drupal CMS?

I'm attaching some screenshots as evidence that it works as designed with a clean standard Drupal 11 install:

✅ 403 page left empty

403 page left empty, shows the standard 403 text on the frontend theme

✅ 403 page set to /user/login

403 page set to /user/login, shows the login form styled via Gin Login

vinodhini.e’s picture

Hi, Tested this on Drupal 11.2.3 with the Gin theme and Gin login enabled and /user/login set as the 403 page. As mentioned in the @wilson3 comment, after testing, the issue could not be reproduced — the login form rendered correctly and no broken layout was observed.

Could you provide more detailed steps to reproduce the issue?

pameeela’s picture

Issue summary: View changes
StatusFileSize
new110.18 KB

FWIW the original report is not about Drupal CMS :)

I believe the screenshot in #4 actually does show the problem, compare side by side with the form at /user? The fields are weirdly indented and the page title is squished.

Here is what it looks like in Drupal CMS, it is more obvious because of theme differences.

pameeela’s picture

Does not appear to be the same as #3547364: Stylesheet missing on /user/register when 403. As noted in the OP, the issue is that the front end theme is loaded rather than the admin theme.

jwilson3’s picture

Thanks for clarifications. So this is not the same issue as #3547364: Stylesheet missing on /user/register when 403, but its in the same vein and the fix there would likely be influenced in some way by a fix for this issue.

pameeela’s picture

I was able to take a look at this and unfortunately the other issue doesn't help with this one. Our problem is in ThemeNegotiator, when the route match happens in negotiateRoute to determine whether to swap the theme, the match fails because it uses the original request route. Somewhere along the line the route changes to match user.login so that's why everything else happens as expected later on, it just loads with the wrong theme.

jurgenhaas made their first commit to this issue’s fork.

jurgenhaas’s picture

Status: Active » Needs review

Found a way to determine the route of the sub-request, this should resolve all similar issues.

phenaproxima’s picture

Status: Needs review » Needs work
StatusFileSize
new98.87 KB

Manually tested !52 against vanilla core (11.3.x-dev). It didn't seem to work. What I did:

  1. Installed clean; drush si -y && drush -y en gin_login, with !52 checked out
  2. Logged in as admin and set /user/login as the 403 page
  3. Logged out and tried to visit /admin/structure

It yielded this:

The login screen being displayed by Claro

That looks Claro-ey, but not Gin-ey.

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

Never mind, I'm wrong! I had forgotten to set my admin theme to Gin. When I do that, it works fine!

phenaproxima’s picture

This is a Drupal CMS release target because it will let us remove a couple of annoying workarounds.

  • jurgenhaas committed 2fbfebea on 2.1.x
    feat: #3508338 Add support for 403 subrequests to user.login route
    
    By:...
jurgenhaas’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone, glad we got this sorted.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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