This commit is contained in:
hailin 2025-04-18 17:11:49 +08:00
parent 04c13f3f19
commit 385ceeeb38
4 changed files with 12 additions and 2 deletions

View File

@ -156,6 +156,7 @@ export default async function Login({
return redirect(`/${localeString}/login?message=${error.message}`)
}
console.log("2..................Redirecting with locale:", localeString)
return redirect(`/${localeString}/setup`)
// USE IF YOU WANT TO SEND EMAIL VERIFICATION, ALSO CHANGE TOML FILE

View File

@ -15,7 +15,10 @@ export default function ChangePasswordPage() {
const session = (await supabase.auth.getSession()).data.session
if (!session) {
router.push("/login")
// 提取当前路径中的 locale 部分
const pathname = router.pathname
const locale = pathname.split("/")[1] || "en" // 获取路径中的 locale 部分,如果没有则默认为 "en"
router.push(`${locale}/login`)
} else {
setLoading(false)
}

View File

@ -29,7 +29,12 @@ export const ChangePassword: FC<ChangePasswordProps> = () => {
toast.success("Password changed successfully.")
return router.push("/login")
// 提取当前路径中的 locale 部分
const pathname = router.pathname
const locale = pathname.split("/")[1] || "en" // 获取路径中的 locale 部分,如果没有则默认为 "en"
// 将 locale 添加到跳转 URL 中
return router.push(`/${locale}/login`)
}
return (

View File

@ -26,6 +26,7 @@ export async function middleware(request: NextRequest) {
throw new Error(error?.message)
}
console.log("[middleware] redirecting to ",`/${homeWorkspace.id}/chat`)
return NextResponse.redirect(
new URL(`/${homeWorkspace.id}/chat`, request.url)
)