Language setting is lost for new browser sessions #9918

Closed
opened 2025-12-29 21:24:21 +01:00 by adam · 7 comments
Owner

Originally created by @m2martin on GitHub (Jun 28, 2024).

Originally assigned to: @m2martin on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.0.6

Python Version

3.12

Steps to Reproduce

  1. Be sure to have LOGIN_TIMEOUT > 0 set
  2. Login with a user which has language set to auto
  3. Netbox will show in the language determined from browser language
  4. Go to user preferences and set an alternate language
  5. Netbox will show in alternate language (django_language cookie is set)
  6. Close your browser and navigate to your Netbox again with a new browser instance (of course with the same browser)
  7. The user is still logged in but language is again detected by browser language

This is because django_language cookie's lifetime is set to browser session's lifetime. Each time the browser is closed, the cookie is deleted. Because no new login happens, the language is not set (related #16512).

Expected Behavior

The user's language setting is applied

Observed Behavior

Browser language is applied.

Originally created by @m2martin on GitHub (Jun 28, 2024). Originally assigned to: @m2martin on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.0.6 ### Python Version 3.12 ### Steps to Reproduce 1. Be sure to have `LOGIN_TIMEOUT > 0` set 2. Login with a user which has language set to auto 3. Netbox will show in the language determined from browser language 4. Go to user preferences and set an alternate language 5. Netbox will show in alternate language (`django_language` cookie is set) 6. Close your browser and navigate to your Netbox again with a new browser instance (of course with the same browser) 7. The user is still logged in but language is again detected by browser language This is because `django_language` cookie's lifetime is set to browser session's lifetime. Each time the browser is closed, the cookie is deleted. Because no new login happens, the language is not set (related #16512). ### Expected Behavior The user's language setting is applied ### Observed Behavior Browser language is applied.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:24:21 +01:00
adam closed this issue 2025-12-29 21:24:21 +01:00
Author
Owner

@jeffgdotorg commented on GitHub (Jun 28, 2024):

Thanks for reporting this problem. I was able to reproduce it in the lab.

I'm moving your issue to needs owner status. If you or another developer with the requisite skills and capacity want to work it through to a PR, please say so and a maintainer will assign the issue to you.

@jeffgdotorg commented on GitHub (Jun 28, 2024): Thanks for reporting this problem. I was able to reproduce it in the lab. I'm moving your issue to `needs owner` status. If you or another developer with the requisite skills and capacity want to work it through to a PR, please say so and a maintainer will assign the issue to you.
Author
Owner

@m2martin commented on GitHub (Jun 28, 2024):

You can assign it to me. I've got a fix ready (not perfect but ready for discussion).

@m2martin commented on GitHub (Jun 28, 2024): You can assign it to me. I've got a fix ready (not perfect but ready for discussion).
Author
Owner

@salfers commented on GitHub (Jul 24, 2024):

It seems like this bug still exists. Sometimes after a day or so (?) the Netbox language still resets to my browser language (German) for me, while English is configured for my user.
This is with v4.0.7.

@salfers commented on GitHub (Jul 24, 2024): It seems like this bug still exists. Sometimes after a day or so (?) the Netbox language still resets to my browser language (German) for me, while English is configured for my user. This is with v4.0.7.
Author
Owner

@m2martin commented on GitHub (Jul 25, 2024):

Since the patch I did not have any problems. As the language is determined by the language cookie, can you please double check the cookie's existence and lifetime using your browser's developer tools?
Its lifetime should be aligned with the session lifetime.

@m2martin commented on GitHub (Jul 25, 2024): Since the patch I did not have any problems. As the language is determined by the language cookie, can you please double check the cookie's existence and lifetime using your browser's developer tools? Its lifetime should be aligned with the session lifetime.
Author
Owner

@salfers commented on GitHub (Jul 25, 2024):

I managed to reproduce it reliably:
When I clear cookies, log in with a password the language cookie is set to the correct value and I get an English interface.
When I clear cookies, log in with SSO the language cookie is not set at all and I get a German interface (browser language).

@salfers commented on GitHub (Jul 25, 2024): I managed to reproduce it reliably: When I clear cookies, log in with a password the language cookie is set to the correct value and I get an English interface. When I clear cookies, log in with SSO the language cookie is *not* set at all and I get a German interface (browser language).
Author
Owner

@m2martin commented on GitHub (Jul 25, 2024):

OK, which type of SSO do you use?

As you said, the cookie is not created at all after login, it seems to be not related to this issue. Could you please create a new one with a complete bug description?

@m2martin commented on GitHub (Jul 25, 2024): OK, which type of SSO do you use? As you said, the cookie is not created at all after login, it seems to be not related to this issue. Could you please create a new one with a complete bug description?
Author
Owner

@salfers commented on GitHub (Jul 26, 2024):

Just opened a new issue.

@salfers commented on GitHub (Jul 26, 2024): Just opened a new issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9918