From 7cc3dfa0a0703c8ff9ca6ec465becfcc91d891a7 Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:34:17 +0800 Subject: [PATCH] fix: remove httpOnly from language cookie to allow JS to access current language (#6933) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug /area core /milestone 2.20.x #### What this PR does / why we need it: 修复登录时切换了其他语言但是登录成功后始终显示中文的问题 此问题为 https://github.com/halo-dev/halo/pull/6891 导致 #### Does this PR introduce a user-facing change? ```release-note 修复登录时切换了其他语言但是登录成功后始终显示中文的问题 ``` --- .../java/run/halo/app/infra/webfilter/LocaleChangeWebFilter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/application/src/main/java/run/halo/app/infra/webfilter/LocaleChangeWebFilter.java b/application/src/main/java/run/halo/app/infra/webfilter/LocaleChangeWebFilter.java index d4bd8e661f..5f1885a59f 100644 --- a/application/src/main/java/run/halo/app/infra/webfilter/LocaleChangeWebFilter.java +++ b/application/src/main/java/run/halo/app/infra/webfilter/LocaleChangeWebFilter.java @@ -54,7 +54,6 @@ public Mono filter(ServerWebExchange exchange, WebFilterChain chain) { void setLanguageCookie(ServerWebExchange exchange, Locale locale) { var cookie = ResponseCookie.from(LANGUAGE_COOKIE_NAME, locale.toLanguageTag()) .path("/") - .httpOnly(true) .secure("https".equalsIgnoreCase(exchange.getRequest().getURI().getScheme())) .sameSite("Lax") .build();