Skip to content

Conversation

@belcirelk
Copy link
Contributor

The login page is set to the default browser language, but it's impossible to change the language using the select a the bottom of the login page. The page reload back the previous language.
The readCookie('language') returns null, the reason is that the cookie is set as HTTPonly and can not be read by javascript. The solution is to read the cookie via the tpl instead.

closes #747

The login page is set to the default browser language, but it's impossible
to change the language using the select a the bottom of the login page.
The page reload back the previous language.
The readCookie('language') returns null, the reason is that the cookie
is set as HTTPonly and can not be read by javascript. The solution
is to read the cookie via the tpl instead.

closes LibreBooking#747
@JohnVillalovos JohnVillalovos requested a review from Copilot July 24, 2025 13:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a language selector issue on the login page where users cannot change the language due to an HTTPOnly cookie that cannot be read by JavaScript. The fix replaces JavaScript cookie reading with server-side template variable access.

  • Replaces client-side cookie reading with server-side Smarty template variable
  • Enables proper language selector functionality on the login page
  • Resolves issue where page would reload to previous language instead of selected language

@JohnVillalovos
Copy link
Contributor

JohnVillalovos commented Jul 24, 2025

I just tried this and I'm not seeing a difference. I tried to use "Espanol" as the language and don't notice any difference.

This is after I selected "Espanol" It still shows "English US" and content is English.

image

@JohnVillalovos
Copy link
Contributor

One thing I am noticing on my test instance is that this is the cookie set:

{
	"Response Cookies": {
		"language": {
			"expires": "2025-08-23T15:56:33.000Z",
			"httpOnly": true,
			"path": "/Web",
			"samesite": "Lax",
			"secure": true,
			"value": "es"
		}
	}
}

I am NOT using HTTPS on my test instance and here we can see that secure: true. Will need to figure out how to make the language cookie to be allowed to not be secure.

@belcirelk
Copy link
Contributor Author

Yes, the way it's done currently it will only work over HTTPS.

@JohnVillalovos
Copy link
Contributor

LGTM. I have a follow on fix for the cookie to change it to not be required to be HTTPS.

@JohnVillalovos JohnVillalovos merged commit c4be7bc into LibreBooking:develop Jul 24, 2025
11 checks passed
@belcirelk belcirelk deleted the fix/resolve-language-selector-login branch July 30, 2025 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The language selector is not working

2 participants