feat: add ability to send login code via email (#457)

Co-authored-by: Kyle Mendell <kmendell@ofkm.us>
This commit is contained in:
Elias Schneider
2025-04-20 18:32:40 +02:00
committed by GitHub
parent e571996cb5
commit fe1c4b18cd
22 changed files with 257 additions and 137 deletions

View File

@@ -73,7 +73,7 @@
id="application-configuration-email"
icon={Mail}
title={m.email()}
description={m.enable_email_notifications_to_alert_users_when_a_login_is_detected_from_a_new_device_or_location()}
description={m.configure_stmp_to_send_emails()}
>
<AppConfigEmailForm {appConfig} callback={updateAppConfig} />
</CollapsibleCard>

View File

@@ -39,7 +39,8 @@
smtpFrom: z.string().email(),
smtpTls: z.enum(['none', 'starttls', 'tls']),
smtpSkipCertVerify: z.boolean(),
emailOneTimeAccessEnabled: z.boolean(),
emailOneTimeAccessAsUnauthenticatedEnabled: z.boolean(),
emailOneTimeAccessAsAdminEnabled: z.boolean(),
emailLoginNotificationEnabled: z.boolean()
});
@@ -88,9 +89,7 @@
await appConfigService
.sendTestEmail()
.then(() => toast.success(m.test_email_sent_successfully()))
.catch(() =>
toast.error(m.failed_to_send_test_email())
)
.catch(() => toast.error(m.failed_to_send_test_email()))
.finally(() => (isSendingTestEmail = false));
}
</script>
@@ -136,10 +135,16 @@
bind:checked={$inputs.emailLoginNotificationEnabled.value}
/>
<CheckboxWithLabel
id="email-login"
label={m.email_login()}
id="email-login-user"
label={m.emai_login_code_requested_by_user()}
description={m.allow_users_to_sign_in_with_a_login_code_sent_to_their_email()}
bind:checked={$inputs.emailOneTimeAccessEnabled.value}
bind:checked={$inputs.emailOneTimeAccessAsUnauthenticatedEnabled.value}
/>
<CheckboxWithLabel
id="email-login-admin"
label={m.email_login_code_from_admin()}
description={m.allows_an_admin_to_send_a_login_code_to_the_user()}
bind:checked={$inputs.emailOneTimeAccessAsAdminEnabled.value}
/>
</div>
</fieldset>

View File

@@ -161,4 +161,4 @@
{/snippet}
</AdvancedTable>
<OneTimeLinkModal userId={userIdToCreateOneTimeLink} />
<OneTimeLinkModal bind:userId={userIdToCreateOneTimeLink} />