Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🚀 Disable password related features when email login is disabled (#1993)

Luke Vella451c8ee68f44
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index 77fd99676..1de3d6d57 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -558,5 +558,6 @@
"passwordTooWeak": "Password is too weak. Please use a stronger password.",
"resetPasswordButton": "Reset password",
"passwordStrength": "Password Strength",
- "emailChangeInvalidUserId": "Please login with the same email address as the one you used to request the change."
+ "emailChangeInvalidUserId": "Please login with the same email address as the one you used to request the change.",
+ "ssoAuthenticationOnly": "Authentication is managed through Single Sign-On (SSO). Password management is not available."
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/page.tsx
index b392a06cb..7ff228f80 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/page.tsx
@@ -26,6 +26,7 @@ import { getTotalSeatsForSpace } from "@/features/space/utils";
import { getUserHasNoAccounts } from "@/features/user/queries";
import { getTranslation } from "@/i18n/server";
import { IfFeatureEnabled } from "@/lib/feature-flags/client";
+import { isFeatureEnabled } from "@/lib/feature-flags/server";
import { FeedbackAlert } from "./feedback-alert";
import { PasswordSetupAlert } from "./password-setup-alert";
@@ -75,6 +76,8 @@ export default async function Page() {
hasNoAccounts,
} = await loadData();
+ const isEmailLoginEnabled = isFeatureEnabled("emailLogin");
+
return (
<PageContainer>
<PageHeader>
@@ -84,7 +87,7 @@ export default async function Page() {
</PageHeader>
<PageContent className="space-y-8">
<div className="space-y-4">
- {hasNoAccounts ? <PasswordSetupAlert /> : null}
+ {hasNoAccounts && isEmailLoginEnabled ? <PasswordSetupAlert /> : null}
<IfCloudHosted>
<FeedbackAlert />
</IfCloudHosted>
diff --git a/apps/web/src/app/[locale]/(space)/settings/security/page.tsx b/apps/web/src/app/[locale]/(space)/settings/security/page.tsx
index 0b34582dd..ffd5b7ae9 100644
--- a/apps/web/src/app/[locale]/(space)/settings/security/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/security/page.tsx
@@ -1,5 +1,5 @@
import { Alert, AlertDescription } from "@rallly/ui/alert";
-import { ShieldCheckIcon } from "lucide-react";
+import { InfoIcon, ShieldCheckIcon } from "lucide-react";
import type { Metadata } from "next";
import type { Params } from "@/app/[locale]/types";
import {
@@ -21,6 +21,7 @@ import { requireUser } from "@/auth/data";
import { Trans } from "@/components/trans";
import { getUserHasPassword } from "@/features/user/queries";
import { getTranslation } from "@/i18n/server";
+import { isFeatureEnabled } from "@/lib/feature-flags/server";
import { ChangePasswordForm } from "./components/change-password-form";
import { SetupPasswordForm } from "./components/setup-password-form";
@@ -31,7 +32,10 @@ export default async function SecurityPage({
}) {
const { setupPassword } = await searchParams;
const user = await requireUser();
- const hasPassword = await getUserHasPassword(user.id);
+ const isEmailLoginEnabled = isFeatureEnabled("emailLogin");
+ const hasPassword = isEmailLoginEnabled
+ ? await getUserHasPassword(user.id)
+ : false;
return (
<SettingsPage>
@@ -47,59 +51,76 @@ export default async function SecurityPage({
</SettingsPageDescription>
</SettingsPageHeader>
<SettingsPageContent>
- {setupPassword ? (
- <Alert variant="tip">
- <ShieldCheckIcon />
+ {isEmailLoginEnabled ? (
+ <>
+ {setupPassword ? (
+ <Alert variant="tip">
+ <ShieldCheckIcon />
+ <AlertDescription>
+ <p>
+ <Trans
+ i18nKey="passwordSetupSuccessful"
+ defaults="Password setup successful. You can now login with your email and password."
+ />
+ </p>
+ </AlertDescription>
+ </Alert>
+ ) : null}
+ <PageSectionGroup>
+ {hasPassword ? (
+ <PageSection variant="card">
+ <PageSectionHeader>
+ <PageSectionTitle>
+ <Trans
+ i18nKey="changePassword"
+ defaults="Change Password"
+ />
+ </PageSectionTitle>
+ <PageSectionDescription>
+ <Trans
+ i18nKey="changePasswordDescription"
+ defaults="Update your password to keep your account secure"
+ />
+ </PageSectionDescription>
+ </PageSectionHeader>
+ <PageSectionContent>
+ <ChangePasswordForm />
+ </PageSectionContent>
+ </PageSection>
+ ) : (
+ <PageSection variant="card">
+ <PageSectionHeader>
+ <PageSectionTitle>
+ <Trans
+ i18nKey="resetPasswordTitle"
+ defaults="Reset Password"
+ />
+ </PageSectionTitle>
+ <PageSectionDescription className="max-w-lg">
+ <Trans
+ i18nKey="setupPasswordDescription"
+ defaults="Your account doesn't have a password yet. Click the button below to send a secure link to your email to set a password."
+ />
+ </PageSectionDescription>
+ </PageSectionHeader>
+ <PageSectionContent>
+ <SetupPasswordForm />
+ </PageSectionContent>
+ </PageSection>
+ )}
+ </PageSectionGroup>
+ </>
+ ) : (
+ <Alert>
+ <InfoIcon />
<AlertDescription>
- <p>
- <Trans
- i18nKey="passwordSetupSuccessful"
- defaults="Password setup successful. You can now login with your email and password."
- />
- </p>
+ <Trans
+ i18nKey="ssoAuthenticationOnly"
+ defaults="Authentication is managed through Single Sign-On (SSO). Password management is not available."
+ />
</AlertDescription>
</Alert>
- ) : null}
- <PageSectionGroup>
- {hasPassword ? (
- <PageSection variant="card">
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="changePassword" defaults="Change Password" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="changePasswordDescription"
- defaults="Update your password to keep your account secure"
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <ChangePasswordForm />
- </PageSectionContent>
- </PageSection>
- ) : (
- <PageSection variant="card">
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans
- i18nKey="resetPasswordTitle"
- defaults="Reset Password"
- />
- </PageSectionTitle>
- <PageSectionDescription className="max-w-lg">
- <Trans
- i18nKey="setupPasswordDescription"
- defaults="Your account doesn't have a password yet. Click the button below to send a secure link to your email to set a password."
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <SetupPasswordForm />
- </PageSectionContent>
- </PageSection>
- )}
- </PageSectionGroup>
+ )}
</SettingsPageContent>
</SettingsPage>
);