Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presence of language prefix in URL incorrectly assigns admin session #2511

Closed
CherryDT opened this issue May 22, 2019 · 4 comments
Closed

Presence of language prefix in URL incorrectly assigns admin session #2511

CherryDT opened this issue May 22, 2019 · 4 comments

Comments

@CherryDT
Copy link

I discovered the following strange behavior on a multi-language page with admin plugin:

  • After logging into the admin, my username would appear in the navbar on the page, but only sometimes. Further investigation showed that it would be hidden on the homepage with language prefix without trailing slash (e.g. /en) but visible with the trailing slash (e.g. /en/) or on sub-pages (e.g. /en/blog). This particular symptom is actually because of Utils::pathPrefixedByLangCode doesn't detect homepage with prefix without trailing slash #2510 in combination with this bug.
  • The "save language in session" feature would not work for me (after I "fixed" the previous issue using a htaccess redirect from /en to /en/ - I hadn't fully understood the problem yet). Further investigation showed that on / a different session would be used than on /en///de/, and hence the new language would be written to session A but / would read from session B and redirect to the wrong language.

Turns out that this is due to a bug in SessionServiceProvider.php: It sets $is_admin = true if the route starts with /admin or with a language prefix. It should instead check if it starts with /<prefix>/admin in that case!

@CherryDT
Copy link
Author

I fixed the issue in #2512

@CherryDT
Copy link
Author

CherryDT commented May 26, 2019

Thanks for the commit, however I'm not sure I understand how this works. Won't Utils::pathPrefixedByLangCode simply return true, which - if you stuff it into string concatenation - will become 1, and hence you are now checking for /1/admin (or //admin if it was false)?

@rhukster
Copy link
Member

rhukster commented May 26, 2019

There's a second commit with a change in the Utils function. 8a7f624

sorry, forgot i commited this first.

@CherryDT
Copy link
Author

Ooh, right, I'm sorry, I didn't realize. Never mind then, thanks for the fix!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants