email template

This commit is contained in:
debu-2 2026-10-05 21:00:05 +05:30
parent ebbb582e99
commit 2451045693
15 changed files with 447 additions and 156 deletions

View file

@ -43,7 +43,7 @@ function validateForm(form, companyDomain) {
} else if (!EMAIL_LOCAL_PATTERN.test(local)) {
errors.email_local = "Enter a valid email address before @.";
}
if (!form.password.trim()) {
if (!form.send_invitation && !form.password.trim()) {
errors.password = "Please set an initial password.";
}
if (form.send_invitation) {
@ -178,8 +178,8 @@ export default function AddEmployeeForm({
section_id: form.section_id || undefined,
org_role: form.org_role,
send_invitation: form.send_invitation,
force_password_change: form.force_password_change,
password: form.password,
force_password_change: form.send_invitation ? false : form.force_password_change,
password: form.send_invitation ? undefined : form.password,
},
token,
);
@ -327,7 +327,7 @@ export default function AddEmployeeForm({
<SetupField
label={form.send_invitation ? <RequiredLabel>Invitation email</RequiredLabel> : "Invitation email"}
error={fieldErrors.invitation_email}
hint={`Personal email where aGentic Email sends the setup invite from @${platformDomain}.`}
hint={`Personal email where we send the setup invite from invites@${platformDomain}.`}
>
<InputWrap icon={Mail}>
<input
@ -340,21 +340,6 @@ export default function AddEmployeeForm({
</InputWrap>
</SetupField>
<SetupField
label={<RequiredLabel>Initial password</RequiredLabel>}
error={fieldErrors.password}
hint="Must include uppercase, lowercase, and a number."
>
<InputWrap icon={Lock}>
<input
type="password"
value={form.password}
onChange={(event) => updateField("password", event.target.value)}
placeholder="Set an initial password"
/>
</InputWrap>
</SetupField>
<div className="add-user-checkboxes">
<label className="add-user-checkbox">
<input
@ -364,23 +349,42 @@ export default function AddEmployeeForm({
/>
<span>
<strong>Send invitation email</strong>
<small>They will receive an activation link to set their password.</small>
</span>
</label>
<label className="add-user-checkbox">
<input
type="checkbox"
checked={form.force_password_change}
onChange={(event) => updateField("force_password_change", event.target.checked)}
/>
<span>
<strong>Require password change on first login</strong>
<small>User must create a new password when they sign in for the first time.</small>
<small>They will receive a secure link to set their password (expires in 48 hours).</small>
</span>
</label>
</div>
{!form.send_invitation && (
<>
<SetupField
label={<RequiredLabel>Initial password</RequiredLabel>}
error={fieldErrors.password}
hint="Must include uppercase, lowercase, and a number."
>
<InputWrap icon={Lock}>
<input
type="password"
value={form.password}
onChange={(event) => updateField("password", event.target.value)}
placeholder="Set an initial password"
/>
</InputWrap>
</SetupField>
<label className="add-user-checkbox">
<input
type="checkbox"
checked={form.force_password_change}
onChange={(event) => updateField("force_password_change", event.target.checked)}
/>
<span>
<strong>Require password change on first login</strong>
<small>User must create a new password when they sign in for the first time.</small>
</span>
</label>
</>
)}
{status.error && <p className="form-error" role="alert">{status.error}</p>}
<footer className={variant === "inline" ? "org-setup-actions" : "add-user-actions"}>