fix(settings): the offline language mirror does not outlive the account (#2146)

The mirror of the account language stayed in localStorage past logout, so the next account on the device booted in the previous user's language forever. It is cleared on logout and rewritten on login, and the rate-limit message follows the same order the boot language does.
This commit is contained in:
Maurice
2026-09-02 19:00:49 +02:00
committed by Maurice
parent 7c857173cf
commit a5d87d295a
5 changed files with 83 additions and 6 deletions
+5
View File
@@ -12,6 +12,7 @@ import { useSystemNoticeStore } from './systemNoticeStore.js'
import { clearAppearanceSnapshot } from '../theme/applyAppearance'
import { clearAllPluginSessions } from './pluginStore'
import { forgetStartDestination } from '../utils/startDestination'
import { forgetServerLanguage } from './settingsStore'
import { markSignedOut, clearSignedOut } from '../utils/signedOut'
interface AuthResponse {
@@ -236,6 +237,10 @@ export const useAuthStore = create<AuthState>()(
// And the startup-destination mirror, or the next account on this browser
// gets bounced into a trip it may not even be able to see.
forgetStartDestination()
// Likewise the language mirror: the login page only overrides it when the
// browser language is one TREK ships, so otherwise the next user here stays
// in the previous account's language, launch after launch.
forgetServerLanguage()
// 4. Tell server to clear the httpOnly cookie (best-effort).
await fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }).catch(() => {})
// 5. Clear service worker caches containing sensitive data.