Skip to content

Commit cf327fc

Browse files
authored
Disabled SMTP badge in "Initiate self-enrollment" button (#2114)
1 parent 7fe70b6 commit cf327fc

3 files changed

Lines changed: 31 additions & 20 deletions

File tree

web/messages/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"state_enabled": "Enabled",
4646
"state_not_configured": "Not configured",
4747
"state_smtp_not_configured": "SMTP configuration has not been completed by the administrator.",
48+
"state_smtp_not_configured_admin": "SMTP not configured. Please configure SMTP to send enrollment details by email.",
4849
"state_step": "Step {step}",
4950
"state_pending": "Pending",
5051
"state_enrolled": "Enrolled",

web/src/pages/UsersOverviewPage/modals/EnrollmentTokenModal/EnrollmentTokenModal.tsx

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import api from '../../../../shared/api/api';
66
import { AppText } from '../../../../shared/defguard-ui/components/AppText/AppText';
77
import { Checkbox } from '../../../../shared/defguard-ui/components/Checkbox/Checkbox';
88
import { CopyField } from '../../../../shared/defguard-ui/components/CopyField/CopyField';
9+
import { IconKind } from '../../../../shared/defguard-ui/components/Icon/icon-types';
10+
import { InfoBanner } from '../../../../shared/defguard-ui/components/InfoBanner/InfoBanner';
911
import { Modal } from '../../../../shared/defguard-ui/components/Modal/Modal';
1012
import { ModalControls } from '../../../../shared/defguard-ui/components/ModalControls/ModalControls';
1113
import { SizedBox } from '../../../../shared/defguard-ui/components/SizedBox/SizedBox';
@@ -149,26 +151,34 @@ const ModalContent = ({ user, appInfo, enrollmentResponse }: ModalData) => {
149151
data-testid="activation-token-field"
150152
text={enrollmentResponse.enrollment_token}
151153
/>
152-
{appInfo.smtp_enabled && (
153-
<>
154-
<SizedBox height={ThemeSpacing.Xl3} />
155-
<form.AppForm>
156-
<Checkbox
157-
text={m.modal_add_user_enrollment_form_label_send()}
158-
active={sendEmail}
159-
onClick={() => setSendEmail((s) => !s)}
154+
<SizedBox height={ThemeSpacing.Xl3} />
155+
<form.AppForm>
156+
{!appInfo.smtp_enabled && (
157+
<>
158+
<InfoBanner
159+
icon={IconKind.InfoFilled}
160+
text={m.state_smtp_not_configured_admin()}
161+
variant="warning"
160162
/>
161-
{sendEmail && (
162-
<>
163-
<SizedBox height={ThemeSpacing.Xl} />
164-
<form.AppField name="email">
165-
{(field) => <field.FormInput label={m.form_label_email()} />}
166-
</form.AppField>
167-
</>
168-
)}
169-
</form.AppForm>
170-
</>
171-
)}
163+
<SizedBox height={ThemeSpacing.Md} />
164+
</>
165+
)}
166+
<Checkbox
167+
text={m.modal_add_user_enrollment_form_label_send()}
168+
active={sendEmail}
169+
disabled={!appInfo.smtp_enabled}
170+
onClick={() => setSendEmail((s) => !s)}
171+
/>
172+
{sendEmail && (
173+
<>
174+
<SizedBox height={ThemeSpacing.Xl} />
175+
<form.AppField name="email">
176+
{(field) => <field.FormInput label={m.form_label_email()} required />}
177+
</form.AppField>
178+
</>
179+
)}
180+
</form.AppForm>
181+
172182
<form.Subscribe>
173183
{() => (
174184
<ModalControls

web/src/shared/defguard-ui

0 commit comments

Comments
 (0)