-
+
+
diff --git a/packages/client/src/lib/utils.ts b/packages/client/src/lib/utils.ts
index 7b55efed8..b52f82785 100644
--- a/packages/client/src/lib/utils.ts
+++ b/packages/client/src/lib/utils.ts
@@ -145,3 +145,7 @@ export function formatOfficerDepartment(unit: FullOfficer | FullDeputy) {
return getUnitDepartment(unit)?.value.value ?? null;
}
+
+export function canUseDiscordAuth() {
+ return typeof window !== "undefined" && window.location === window.parent.location;
+}
diff --git a/packages/client/src/pages/account.tsx b/packages/client/src/pages/account.tsx
index f595627ef..c332d22e3 100644
--- a/packages/client/src/pages/account.tsx
+++ b/packages/client/src/pages/account.tsx
@@ -13,6 +13,7 @@ import { useFeatureEnabled } from "hooks/useFeatureEnabled";
import { useMounted } from "@casper124578/useful";
import { Title } from "components/shared/Title";
import { toastError } from "lib/error";
+import { canUseDiscordAuth } from "lib/utils";
const AccountSettingsTab = dynamic(async () => {
return (await import("components/account/AccountSettingsTab")).AccountSettingsTab;
@@ -54,7 +55,7 @@ export default function Account() {
{ name: t("appearanceSettings"), value: "appearanceSettings" },
];
- if (DISCORD_AUTH) {
+ if (DISCORD_AUTH && canUseDiscordAuth()) {
TABS_TITLES[3] = { name: t("connections"), value: "connections" };
}
diff --git a/packages/client/src/pages/auth/login.tsx b/packages/client/src/pages/auth/login.tsx
index 48e9d1937..1ddc5276a 100644
--- a/packages/client/src/pages/auth/login.tsx
+++ b/packages/client/src/pages/auth/login.tsx
@@ -18,6 +18,7 @@ import { useFeatureEnabled } from "hooks/useFeatureEnabled";
import { Title } from "components/shared/Title";
import { AuthScreenImages } from "components/auth/AuthScreenImages";
import { TwoFactorAuthScreen } from "components/auth/TwoFactorAuthScreen";
+import { canUseDiscordAuth } from "lib/utils";
const INITIAL_VALUES = {
username: "",
@@ -139,7 +140,7 @@ export default function Login() {
- {DISCORD_AUTH ? (
+ {DISCORD_AUTH && canUseDiscordAuth() ? (
<>