MNTOR-2938 exposed that we are not consistently passing `authOptions`… (#4205)

* MNTOR-2938 exposed that we are not consistently passing `authOptions` to `getServerSession`

This returns an incomplete `session` object.

* check fxa uid for consistency
This commit is contained in:
Robert Helmer 2024-02-13 13:02:20 -08:00 коммит произвёл GitHub
Родитель 6c196f57ee
Коммит 5444565acb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -22,6 +22,7 @@ import { sendVerificationEmail } from "../../../../../../api/utils/email";
import { getL10n } from "../../../../../../functions/server/l10n";
import { logger } from "../../../../../../functions/server/logging";
import { CONST_MAX_NUM_ADDRESSES } from "../../../../../../../constants";
import { authOptions } from "../../../../../../api/utils/auth";
export type AddEmailFormState =
| { success?: never }
@ -37,7 +38,7 @@ export async function onAddEmail(
formData: FormData,
): Promise<AddEmailFormState> {
const l10n = getL10n();
const session = await getServerSession();
const session = await getServerSession(authOptions);
if (!session?.user.subscriber?.fxa_uid) {
return {
success: false,

Просмотреть файл

@ -14,10 +14,11 @@ import {
import { getEnabledFeatureFlags } from "../../../../db/tables/featureFlags";
import { getL10n } from "../../../functions/server/l10n";
import { View } from "./LandingView";
import { authOptions } from "../../../api/utils/auth";
export default async function Page() {
const session = await getServerSession();
if (typeof session?.user.email === "string") {
const session = await getServerSession(authOptions);
if (typeof session?.user.subscriber?.fxa_uid === "string") {
return redirect("/user/dashboard/");
}
const enabledFlags = await getEnabledFeatureFlags({ ignoreAllowlist: true });