show smtp note on whitelist

This commit is contained in:
miloschwartz 2025-04-23 16:24:49 -04:00
parent a6d6aaaadd
commit 548a883e3f
No known key found for this signature in database

View file

@ -46,6 +46,8 @@ import { InfoPopup } from "@app/components/ui/info-popup";
import { Tag, TagInput } from "@app/components/tags/tag-input"; import { Tag, TagInput } from "@app/components/tags/tag-input";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { UserType } from "@server/types/UserTypes"; import { UserType } from "@server/types/UserTypes";
import { Alert, AlertDescription, AlertTitle } from "@app/components/ui/alert";
import { InfoIcon } from "lucide-react";
const UsersRolesFormSchema = z.object({ const UsersRolesFormSchema = z.object({
roles: z.array( roles: z.array(
@ -612,7 +614,6 @@ export default function ResourceAuthenticationPage() {
</SettingsSectionBody> </SettingsSectionBody>
</SettingsSection> </SettingsSection>
{env.email.emailEnabled && (
<SettingsSection> <SettingsSection>
<SettingsSectionHeader> <SettingsSectionHeader>
<SettingsSectionTitle> <SettingsSectionTitle>
@ -624,14 +625,26 @@ export default function ResourceAuthenticationPage() {
</SettingsSectionDescription> </SettingsSectionDescription>
</SettingsSectionHeader> </SettingsSectionHeader>
<SettingsSectionBody> <SettingsSectionBody>
{!env.email.emailEnabled && (
<Alert variant="neutral" className="mb-4">
<InfoIcon className="h-4 w-4" />
<AlertTitle className="font-semibold">
SMTP Required
</AlertTitle>
<AlertDescription>
SMTP must be enabled on the server to use one-time password authentication.
</AlertDescription>
</Alert>
)}
<SwitchInput <SwitchInput
id="whitelist-toggle" id="whitelist-toggle"
label="Email Whitelist" label="Email Whitelist"
defaultChecked={resource.emailWhitelistEnabled} defaultChecked={resource.emailWhitelistEnabled}
onCheckedChange={setWhitelistEnabled} onCheckedChange={setWhitelistEnabled}
disabled={!env.email.emailEnabled}
/> />
{whitelistEnabled && ( {whitelistEnabled && env.email.emailEnabled && (
<Form {...whitelistForm}> <Form {...whitelistForm}>
<form id="whitelist-form"> <form id="whitelist-form">
<FormField <FormField
@ -722,7 +735,6 @@ export default function ResourceAuthenticationPage() {
</Button> </Button>
</SettingsSectionFooter> </SettingsSectionFooter>
</SettingsSection> </SettingsSection>
)}
</SettingsContainer> </SettingsContainer>
</> </>
); );