This commit is contained in:
parent
a3ac46da2a
commit
310c90d573
|
|
@ -25,15 +25,8 @@ export default async function Login({
|
||||||
}) {
|
}) {
|
||||||
const cookieStore = cookies()
|
const cookieStore = cookies()
|
||||||
|
|
||||||
// 优先从 cookie 获取 locale,否则使用 URL 参数中的 locale
|
|
||||||
//const localeString = cookieStore.get('locale')?.value || locale;
|
|
||||||
|
|
||||||
const localeString = locale;
|
const localeString = locale;
|
||||||
|
|
||||||
const { t, resources } = await initTranslations(localeString, ['translation']);
|
const { t, resources } = await initTranslations(localeString, ['translation']);
|
||||||
// 打印翻译内容确认是否正常加载
|
|
||||||
// console.log("...............localeString: ", {localeString});
|
|
||||||
// console.log("Translation for login.email: ", t("login.email"));
|
|
||||||
|
|
||||||
const supabase = createServerClient<Database>(
|
const supabase = createServerClient<Database>(
|
||||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||||
|
|
@ -93,9 +86,9 @@ export default async function Login({
|
||||||
.single()
|
.single()
|
||||||
|
|
||||||
if (!homeWorkspace) {
|
if (!homeWorkspace) {
|
||||||
const fallbackMessage = String(t("login.unexpectedError"))
|
//const fallbackMessage = String(t("login.unexpectedError"))
|
||||||
throw new Error(
|
throw new Error(
|
||||||
homeWorkspaceError?.message || fallbackMessage
|
homeWorkspaceError?.message || "An unexpected error occurred"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,7 +129,7 @@ export default async function Login({
|
||||||
const domainMatch = emailDomainWhitelist?.includes(email.split("@")[1])
|
const domainMatch = emailDomainWhitelist?.includes(email.split("@")[1])
|
||||||
const emailMatch = emailWhitelist?.includes(email)
|
const emailMatch = emailWhitelist?.includes(email)
|
||||||
if (!domainMatch && !emailMatch) {
|
if (!domainMatch && !emailMatch) {
|
||||||
const errorMessage = String(t("login.signupNotAllowed", { email })) // ← 这是字符串
|
//const errorMessage = String(t("login.signupNotAllowed", { email })) // ← 这是字符串
|
||||||
console.log(`[login page] SignUp======>Redirecting to workspace:, ${errorMessage}`)
|
console.log(`[login page] SignUp======>Redirecting to workspace:, ${errorMessage}`)
|
||||||
return redirect(
|
return redirect(
|
||||||
`/${localeString}/login?message=Email ${email} is not allowed to sign up.`
|
`/${localeString}/login?message=Email ${email} is not allowed to sign up.`
|
||||||
|
|
@ -185,8 +178,9 @@ export default async function Login({
|
||||||
return redirect(`/${localeString}/login?message=${error.message}`)
|
return redirect(`/${localeString}/login?message=${error.message}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const emailtoResetMessage = String(t("login.checkEmailToReset")) // ← 这是字符串
|
// const emailtoResetMessage = String(t("login.checkEmailToReset")) // ← 这是字符串
|
||||||
return redirect(`/${localeString}/login?message=${emailtoResetMessage}`)
|
// return redirect(`/${localeString}/login?message=${emailtoResetMessage}`)
|
||||||
|
return redirect(`/${localeString}/login?message=Check email to reset password`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue