Problem/Motivation
Currently, if a user visits /user/login which is for example excluded with ~/user/login from being redirected, but the site is using url language path prefixes then the first request that hits AnonymousLoginSubscriber with the path being "/user/login" will not get redirected, but since this url will redirect to e.g. "/nl/user/login" this second request will not be properly handled and the Anonymous Login will now initiate a redirect.
Steps to reproduce
Proposed resolution
Cut language path prefixes from the url to be checked.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork anonymous_login-3607104
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
Comment #3
hchonovComment #6
anton4uk commentedThanks @hchonov, for the report and MR !20! This is a real problem: with URL prefixes,
/uk/user/reset/…doesn't match the hard-codeduser/reset/*exclusion, so password reset links in non-default languages redirect to the login page.MR !20 strips the prefix too late, after the alias lookup, so aliased pages with a prefix never match. For example, with
~node/123excluded,/uk/my-aliasis still redirected. It also usesurl.prefixeseven when negotiation isn't set to path prefixes.I pushed an alternative in
3607104-language-prefixes. It strips the prefix before the alias lookup, only when path prefix negotiation is used, and keeps the prefix in thedestination. It also adds unit tests for prefixed paths.To test: add a second language with URL prefixes and set the paths to
*. As anonymous, open/uk/user/reset/1/…: it should be handled by core, not redirected to login. Then exclude an aliased node (~node/NID) and open/uk/its-alias: it should not redirect.Comment #8
anton4uk commentedComment #13
japerryComment #14
japerryThe change merged from here and released in 8.x-2.3 has two regressions.
Patterns that include the language prefix stopped matching. In 8.x-2.2 paths were matched with their prefix, so a pattern such as fr/node/* was the way to target a prefixed path. Since 8.x-2.3 the prefix is removed before matching, so those patterns match nothing: included pages become public and excluded pages (for example ~fr/user/register) are redirected.
The prefix is also removed on multilingual sites that do not detect the language from the URL. There a path that starts with a language code is an ordinary path, and core does not remove the prefix either.
I made a new MR (MR!32) which does the following:
Comment #15
japerry