From 91d38ccf732555c20e4f65d667f0a774331ba44a Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:47:21 +0100 Subject: [PATCH 1/2] feat: add session alert template --- .../auth/templates/+page.svelte | 16 ++++++- .../emailSessionAlertTemplate.svelte | 46 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/routes/console/project-[project]/auth/templates/emailSessionAlertTemplate.svelte diff --git a/src/routes/console/project-[project]/auth/templates/+page.svelte b/src/routes/console/project-[project]/auth/templates/+page.svelte index cc4d83c4da..b36728ef51 100644 --- a/src/routes/console/project-[project]/auth/templates/+page.svelte +++ b/src/routes/console/project-[project]/auth/templates/+page.svelte @@ -44,6 +44,9 @@ import EmailMagicUrlTemplate from './emailMagicUrlTemplate.svelte'; import EmailRecoveryTemplate from './emailRecoveryTemplate.svelte'; import EmailInviteTemplate from './emailInviteTemplate.svelte'; + import Email2FaTemplate from './email2FATemplate.svelte'; + import EmailSessionAlertTemplate from './emailSessionAlertTemplate.svelte'; + // import SmsVerificationTemplate from './smsVerificationTemplate.svelte'; // import SmsLoginTemplate from './smsLoginTemplate.svelte'; // import { baseEmailTemplate, baseSmsTemplate, emailTemplate, smsTemplate } from './store'; @@ -59,7 +62,7 @@ EmailTemplateType, EmailTemplateLocale } from '@appwrite.io/console'; - import Email2FaTemplate from './email2FATemplate.svelte'; + import { b } from 'vitest/dist/suite-IbNSsUWN'; const projectId = $page.params.project; @@ -69,6 +72,7 @@ $: emailResetPassword = emailOpen === 'recovery'; $: emailInviteUser = emailOpen === 'invitation'; $: email2FAVerificationOpen = emailOpen === 'mfaChallenge'; + $: emailSessionAlertOpen = emailOpen === 'sessionAlert'; // let smsOpen = 'verification'; // $: smsVerificationOpen = smsOpen === 'verification'; @@ -189,6 +193,16 @@

Send a two-factor authentication email to a user.

+ { + e.preventDefault(); + openEmail('sessionAlert'); + }}> + Session alert +

Send an email to users when a new session is created.

+ +
diff --git a/src/routes/console/project-[project]/auth/templates/emailSessionAlertTemplate.svelte b/src/routes/console/project-[project]/auth/templates/emailSessionAlertTemplate.svelte new file mode 100644 index 0000000000..49fe9e299a --- /dev/null +++ b/src/routes/console/project-[project]/auth/templates/emailSessionAlertTemplate.svelte @@ -0,0 +1,46 @@ + + +
+ + + {'{{user}}'} + {'{{project}}'} + {'{{device}}'} + {'{{ipAddress}}'} + {'{{country}}'} + +
From 84add4e138fee8cf417b2415adcce9a76fb7f0c3 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:47:33 +0100 Subject: [PATCH 2/2] fix: import --- src/routes/console/project-[project]/auth/templates/+page.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/routes/console/project-[project]/auth/templates/+page.svelte b/src/routes/console/project-[project]/auth/templates/+page.svelte index b36728ef51..f9c5ea134b 100644 --- a/src/routes/console/project-[project]/auth/templates/+page.svelte +++ b/src/routes/console/project-[project]/auth/templates/+page.svelte @@ -62,7 +62,6 @@ EmailTemplateType, EmailTemplateLocale } from '@appwrite.io/console'; - import { b } from 'vitest/dist/suite-IbNSsUWN'; const projectId = $page.params.project;