This commit is contained in:
parent
b3c32d4f0a
commit
edfb1fec43
|
|
@ -70,7 +70,11 @@ export default async function Login({
|
|||
console.error("Host URL is not available");
|
||||
}
|
||||
|
||||
return redirect(`/${locale}/system/clearcookies-then-redirect`)
|
||||
//return redirect(`/${locale}/system/clearcookies-then-redirect`)
|
||||
const cookieStore = cookies()
|
||||
const cookieKeys = Array.from(cookieStore.keys())
|
||||
const cookieString = encodeURIComponent(cookieKeys.join(","))
|
||||
return redirect(`/${locale}/system/clearcookies-then-redirect?keys=${cookieString}`)
|
||||
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -2,18 +2,27 @@
|
|||
"use client"
|
||||
|
||||
import { useEffect } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { useRouter, useSearchParams } from "next/navigation"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
export default function ClearCookiesThenRedirect({ params }: { params: { locale: string } }) {
|
||||
const router = useRouter()
|
||||
const { t } = useTranslation()
|
||||
const searchParams = useSearchParams()
|
||||
|
||||
useEffect(() => {
|
||||
// 🔥 手动清除浏览器端 cookie(服务端清除不够)
|
||||
document.cookie = "sb-67-auth-token=; path=/; max-age=0"
|
||||
document.cookie = "sb-67-auth-token-code-verifier=; path=/; max-age=0"
|
||||
document.cookie = "_ga=; path=/; max-age=0"
|
||||
// document.cookie = "sb-67-auth-token=; path=/; max-age=0"
|
||||
// document.cookie = "sb-67-auth-token-code-verifier=; path=/; max-age=0"
|
||||
// document.cookie = "_ga=; path=/; max-age=0"
|
||||
|
||||
const keysParam = searchParams.get("keys")
|
||||
const keys = keysParam ? keysParam.split(",") : []
|
||||
|
||||
keys.forEach((key) => {
|
||||
document.cookie = `${key}=; path=/; max-age=0`
|
||||
})
|
||||
|
||||
|
||||
// ✅ 仍然调用服务端 API 处理 HttpOnly cookie(比如 Supabase 设置的)
|
||||
fetch("/api/clearcookies", { method: "POST" }).finally(() => {
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
window.RUNTIME_ENV = {
|
||||
"SUPABASE_URL": "http://localhost:8000"
|
||||
};
|
||||
Loading…
Reference in New Issue