diff --git a/messages/en-US.json b/messages/en-US.json index 3efc5787..7726dbcf 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -941,6 +941,8 @@ "pincodeAuth": "Authenticator Code", "pincodeSubmit2": "Submit Code", "passwordResetSubmit": "Request Reset", + "passwordResetSmtpRequired": "Please contact your administrator", + "passwordResetSmtpRequiredDescription": "Password reset is not available because no SMTP server is configured. Please contact your administrator for assistance.", "passwordBack": "Back to Password", "loginBack": "Go back to log in", "signup": "Sign up", diff --git a/src/app/auth/reset-password/page.tsx b/src/app/auth/reset-password/page.tsx index 1245ca09..79b9e53e 100644 --- a/src/app/auth/reset-password/page.tsx +++ b/src/app/auth/reset-password/page.tsx @@ -7,6 +7,16 @@ import { cleanRedirect } from "@app/lib/cleanRedirect"; import { getTranslations } from "next-intl/server"; import { internal } from "@app/lib/api"; import { authCookieHeader } from "@app/lib/api/cookies"; +import { pullEnv } from "@app/lib/pullEnv"; +import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert"; +import { InfoIcon } from "lucide-react"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle +} from "@/components/ui/card"; export const dynamic = "force-dynamic"; @@ -22,6 +32,7 @@ export default async function Page(props: { const getUser = cache(verifySession); const user = await getUser(); const t = await getTranslations(); + const env = pullEnv(); if (user) { let loggedOut = false; @@ -44,6 +55,48 @@ export default async function Page(props: { redirectUrl = cleanRedirect(searchParams.redirect); } + // If email is not enabled, show a message instead of the form + if (!env.email.emailEnabled) { + return ( + <> +
+ + + {t("passwordReset")} + + {t("passwordResetDescription")} + + + + + + + {t("passwordResetSmtpRequired")} + + + {t("passwordResetSmtpRequiredDescription")} + + + + +
+ +

+ + {t("loginBack")} + +

+ + ); + } + return ( <>