mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
show contact admin on forgot password if no smtp server
This commit is contained in:
@@ -941,6 +941,8 @@
|
|||||||
"pincodeAuth": "Authenticator Code",
|
"pincodeAuth": "Authenticator Code",
|
||||||
"pincodeSubmit2": "Submit Code",
|
"pincodeSubmit2": "Submit Code",
|
||||||
"passwordResetSubmit": "Request Reset",
|
"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",
|
"passwordBack": "Back to Password",
|
||||||
"loginBack": "Go back to log in",
|
"loginBack": "Go back to log in",
|
||||||
"signup": "Sign up",
|
"signup": "Sign up",
|
||||||
|
|||||||
@@ -7,6 +7,16 @@ import { cleanRedirect } from "@app/lib/cleanRedirect";
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { internal } from "@app/lib/api";
|
import { internal } from "@app/lib/api";
|
||||||
import { authCookieHeader } from "@app/lib/api/cookies";
|
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";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
@@ -22,6 +32,7 @@ export default async function Page(props: {
|
|||||||
const getUser = cache(verifySession);
|
const getUser = cache(verifySession);
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
const t = await getTranslations();
|
const t = await getTranslations();
|
||||||
|
const env = pullEnv();
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
let loggedOut = false;
|
let loggedOut = false;
|
||||||
@@ -44,6 +55,48 @@ export default async function Page(props: {
|
|||||||
redirectUrl = cleanRedirect(searchParams.redirect);
|
redirectUrl = cleanRedirect(searchParams.redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If email is not enabled, show a message instead of the form
|
||||||
|
if (!env.email.emailEnabled) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="w-full max-w-md">
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>{t("passwordReset")}</CardTitle>
|
||||||
|
<CardDescription>
|
||||||
|
{t("passwordResetDescription")}
|
||||||
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<Alert variant="neutral">
|
||||||
|
<InfoIcon className="h-4 w-4" />
|
||||||
|
<AlertTitle className="font-semibold">
|
||||||
|
{t("passwordResetSmtpRequired")}
|
||||||
|
</AlertTitle>
|
||||||
|
<AlertDescription>
|
||||||
|
{t("passwordResetSmtpRequiredDescription")}
|
||||||
|
</AlertDescription>
|
||||||
|
</Alert>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="text-center text-muted-foreground mt-4">
|
||||||
|
<Link
|
||||||
|
href={
|
||||||
|
!searchParams.redirect
|
||||||
|
? `/auth/login`
|
||||||
|
: `/auth/login?redirect=${redirectUrl}`
|
||||||
|
}
|
||||||
|
className="underline"
|
||||||
|
>
|
||||||
|
{t("loginBack")}
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ResetPasswordForm
|
<ResetPasswordForm
|
||||||
|
|||||||
Reference in New Issue
Block a user