emailengine-app 2.79.6 → 2.79.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +32 -0
  3. package/DOCKER_DEPLOYMENT.md +2 -0
  4. package/bin/emailengine.js +29 -13
  5. package/config/default.toml +13 -3
  6. package/data/google-crawlers.json +7 -1
  7. package/docker-compose.yml +12 -3
  8. package/install.sh +2 -0
  9. package/lib/api-routes/account-routes.js +14 -3
  10. package/lib/api-routes/mailbox-routes.js +4 -1
  11. package/lib/api-routes/message-routes.js +6 -5
  12. package/lib/api-routes/outbox-routes.js +7 -4
  13. package/lib/api-routes/settings-routes.js +34 -25
  14. package/lib/api-routes/stats-routes.js +8 -1
  15. package/lib/api-routes/submit-routes.js +2 -1
  16. package/lib/api-routes/template-routes.js +3 -2
  17. package/lib/bounce-detect.js +45 -0
  18. package/lib/consts.js +9 -3
  19. package/lib/egress-filter.js +39 -4
  20. package/lib/email-client/base-client.js +274 -24
  21. package/lib/email-client/gmail/gmail-api.js +15 -7
  22. package/lib/email-client/gmail-client.js +121 -64
  23. package/lib/email-client/imap/mailbox.js +18 -59
  24. package/lib/email-client/imap-client.js +53 -29
  25. package/lib/email-client/notification-handler.js +11 -2
  26. package/lib/email-client/outlook/graph-api.js +106 -90
  27. package/lib/email-client/outlook-client.js +222 -106
  28. package/lib/generate-text-preview.js +10 -5
  29. package/lib/headers-rewriter.js +1 -1
  30. package/lib/llm-pre-process.js +4 -1
  31. package/lib/mcp/json-schema.js +50 -2
  32. package/lib/outbox.js +22 -5
  33. package/lib/passkeys.js +39 -7
  34. package/lib/pre-process.js +4 -1
  35. package/lib/rewrite-text-nodes.js +12 -1
  36. package/lib/schemas.js +27 -5
  37. package/lib/settings.js +19 -1
  38. package/lib/sso.js +60 -7
  39. package/lib/submit-progress.js +29 -0
  40. package/lib/templates.js +11 -0
  41. package/lib/tools.js +115 -53
  42. package/lib/ui-routes/account-routes.js +79 -12
  43. package/lib/ui-routes/admin-config-routes.js +7 -21
  44. package/lib/ui-routes/admin-entities-routes.js +42 -12
  45. package/lib/ui-routes/auth-routes.js +242 -87
  46. package/lib/ui-routes/dashboard-routes.js +1 -1
  47. package/lib/ui-routes/internals-routes.js +2 -0
  48. package/lib/ui-routes/mcp-consent-routes.js +5 -2
  49. package/lib/ui-routes/network-config-routes.js +12 -3
  50. package/lib/ui-routes/oauth-config-routes.js +12 -1
  51. package/lib/ui-routes/route-helpers.js +41 -6
  52. package/lib/ui-routes/settings-page.js +10 -0
  53. package/lib/ui-routes/suppression-list-routes.js +16 -5
  54. package/lib/ui-routes/unsubscribe-routes.js +22 -3
  55. package/lib/webhooks.js +14 -2
  56. package/package.json +17 -17
  57. package/sbom.json +1 -1
  58. package/server.js +63 -35
  59. package/static/css/flyonui.css +1 -1
  60. package/static/css/src/app.tailwind.css +55 -0
  61. package/static/js/app.js +4 -35
  62. package/static/js/passkey-register.js +50 -1
  63. package/static/js/public.js +128 -0
  64. package/static/js/ui.js +183 -6
  65. package/static/licenses.html +371 -770
  66. package/translations/messages.pot +66 -66
  67. package/views/account/passkeys.hbs +141 -0
  68. package/views/account/password.hbs +11 -0
  69. package/views/account/security.hbs +318 -326
  70. package/views/accounts/account.hbs +90 -115
  71. package/views/accounts/register/imap-server.hbs +18 -12
  72. package/views/config/ai.hbs +2 -0
  73. package/views/config/branding.hbs +2 -0
  74. package/views/config/document-store/index.hbs +6 -6
  75. package/views/config/email-processing.hbs +2 -0
  76. package/views/config/imap-proxy.hbs +2 -0
  77. package/views/config/license.hbs +4 -1
  78. package/views/config/logging.hbs +3 -1
  79. package/views/config/mcp.hbs +2 -0
  80. package/views/config/network.hbs +2 -0
  81. package/views/config/oauth/app.hbs +3 -3
  82. package/views/config/oauth/edit.hbs +1 -1
  83. package/views/config/oauth/new.hbs +1 -1
  84. package/views/config/security.hbs +2 -0
  85. package/views/config/service.hbs +2 -0
  86. package/views/config/smtp.hbs +2 -0
  87. package/views/config/webhooks.hbs +9 -6
  88. package/views/error.hbs +6 -0
  89. package/views/layout/app.hbs +6 -3
  90. package/views/layout/login.hbs +1 -1
  91. package/views/layout/prompt.hbs +1 -1
  92. package/views/layout/public.hbs +1 -1
  93. package/views/legal.hbs +1 -1
  94. package/views/partials/filter_editor_js.hbs +1 -1
  95. package/views/partials/gateway_js.hbs +7 -6
  96. package/views/partials/oauth_form.hbs +5 -5
  97. package/views/partials/ui/btn.hbs +8 -2
  98. package/views/partials/ui/confirm-modal.hbs +2 -3
  99. package/views/partials/ui/empty-state.hbs +25 -0
  100. package/views/partials/ui/env-managed-alert.hbs +19 -0
  101. package/views/partials/webhook_form.hbs +1 -1
  102. package/views/partials/webhooks_editor_functions.hbs +5 -5
  103. package/views/unsubscribe.hbs +6 -0
  104. package/workers/api.js +193 -81
  105. package/workers/imap.js +32 -3
  106. package/workers/smtp.js +7 -0
  107. package/workers/submit.js +25 -1
  108. package/workers/webhooks.js +13 -17
  109. package/lib/reconnection-manager.js +0 -106
@@ -1,44 +1,61 @@
1
1
  {{> security_header}}
2
2
 
3
+ {{!-- This page is a status board, not a task list: the question it answers is "how is this
4
+ account protected right now", and the answer is the badge column. So the badges carry the
5
+ color and the actions stay neutral - a settings row's action is a control, not a call to
6
+ action, and six primary-colored buttons in a column drew the eye away from the answer.
7
+ Color is left to mean consequence: error for the one action that weakens the account
8
+ (disabling 2FA), primary only for creating the first password, which is the single thing
9
+ the page is telling an unprotected instance to do. With the color gone the leading icon is
10
+ what tells the buttons apart at a glance. One action per row; anything with entries of its
11
+ own (the password, the passkeys) is summarized here and managed on its own page. --}}
3
12
  <div class="card bg-base-100 shadow-md mb-6">
4
-
5
-
13
+ <div class="card-header">
14
+ <h6 class="card-title text-primary">Sign-in methods</h6>
15
+ </div>
6
16
 
7
17
  <div class="card-body">
8
18
 
9
19
  <ul class="divide-base-content/10 divide-y">
10
20
 
11
21
  <li class="py-4">
12
- <div class="grid grid-cols-3 items-center gap-4">
22
+ <div class="ee-setting-row">
13
23
  <div>Username</div>
14
24
  <div>
15
25
  {{username}}
16
26
  </div>
17
- <div class="text-end">
27
+ <div class="ee-setting-action">
18
28
  {{#if authData.enabled}}
19
- {{> ui/btn label="Sign out everywhere" variant="primary" style="outline"
20
- id="logout-all-btn" overlay="#logoutAllModal"}}
29
+ {{> ui/btn label="Sign out everywhere" variant="neutral" style="soft"
30
+ icon="icon-[tabler--logout]" id="logout-all-btn" overlay="#logoutAllModal"}}
21
31
  {{/if}}
22
32
  </div>
23
33
  </div>
24
34
  </li>
25
35
 
26
36
  <li class="py-4">
27
- <div class="grid grid-cols-3 items-center gap-4">
37
+ <div class="ee-setting-row">
28
38
  <div>Password</div>
29
39
  <div>
30
- {{#if authData.enabled}} ******** {{else}}Not configured{{/if}}
40
+ {{!-- A badge, not "********": the column is read as status, and a row of
41
+ asterisks says the same thing in a different vocabulary --}}
42
+ {{#if authData.enabled}}
43
+ {{> ui/badge label="Configured" variant="success"}}
44
+ {{else}}
45
+ {{> ui/badge label="Not configured" variant="neutral" soft=true}}
46
+ {{/if}}
31
47
  </div>
32
- <div class="text-end">
33
- {{> ui/btn label=(when authData.enabled "Change password" "Create password") variant="primary"
34
- style="outline" size="sm" href="/admin/account/password"}}
48
+ <div class="ee-setting-action">
49
+ {{> ui/btn label=(when authData.enabled "Change password" "Create password")
50
+ variant=(when authData.enabled "neutral" "primary") style="soft" icon="icon-[tabler--lock]"
51
+ href="/admin/account/password"}}
35
52
  </div>
36
53
  </div>
37
54
  </li>
38
55
 
39
56
  {{#if authData.enabled}}
40
57
  <li class="py-4">
41
- <div class="grid grid-cols-3 items-center gap-4">
58
+ <div class="ee-setting-row">
42
59
  <div>Two-Factor Authentication (2FA)</div>
43
60
  <div>
44
61
  {{#if totp.enabled}}
@@ -46,62 +63,55 @@
46
63
  {{else}}
47
64
  {{> ui/badge label="Not configured" variant="neutral" soft=true}}
48
65
  {{/if}}
66
+ {{!-- Passkey sign-in sets requireTotp false, so this row's badge is only
67
+ half the answer while passkeys exist: "Authenticator app" would
68
+ promise a code on every sign-in, and "Not configured" would suggest
69
+ the password is the only way in. --}}
70
+ {{#if passkeyCount}}
71
+ <div class="text-base-content/60 mt-1 text-xs">
72
+ {{~#equals passkeyCount 1}}A passkey signs in{{else}}{{passkeyCount}} passkeys sign
73
+ in{{/equals}} without a password or a code
74
+ </div>
75
+ {{/if}}
49
76
  </div>
50
- <div class="text-end">
77
+ <div class="ee-setting-action">
51
78
  {{#if totp.enabled}}
52
- {{> ui/btn label="Disable 2FA" variant="error" style="outline" id="disable-tfa-btn"
53
- overlay="#disableTfaModal"}}
79
+ {{> ui/btn label="Disable 2FA" variant="error" style="soft" icon="icon-[tabler--shield-off]"
80
+ id="disable-tfa-btn" overlay="#disableTfaModal"}}
54
81
  {{else}}
55
- {{> ui/btn label="Enable 2FA" variant="primary" style="outline" id="enable-tfa-btn"
56
- overlay="#enableTfaModal"}}
82
+ {{!-- qrcode, not a shield: enabling is the QR-scanning ceremony the button
83
+ opens, and the shield is the page's own icon --}}
84
+ {{> ui/btn label="Enable 2FA" variant="neutral" style="soft" icon="icon-[tabler--qrcode]"
85
+ id="enable-tfa-btn" overlay="#enableTfaModal"}}
57
86
  {{/if}}
58
87
  </div>
59
88
  </div>
60
89
  </li>
61
90
 
62
- <li class="py-4">
63
- <div class="grid grid-cols-3 items-start gap-4">
64
- <div class="pt-1">Passkeys
65
- <br><small class="text-base-content/60">Sign in with just a passkey - no password or additional
66
- verification needed.</small>
67
- </div>
91
+ {{!-- A summary, not a control: passkeys are a way into the account, so leaving them
92
+ out of this list would answer "what can sign in as me" wrongly. Everything that
93
+ acts on an individual passkey lives on /admin/account/passkeys, the same split
94
+ the password row above uses. --}}
95
+ <li class="py-4" id="passkeys-summary">
96
+ <div class="ee-setting-row">
97
+ <div>Passkeys</div>
68
98
  <div>
69
- {{#if passkeys.length}}
70
- <ul class="mb-0 space-y-2">
71
- {{#each passkeys}}
72
- <li class="flex items-start justify-between gap-2">
73
- <div>
74
- <strong>{{this.name}}</strong><br>
75
- <small class="text-base-content/60">Added {{this.createdAtFormatted}}</small>
76
- </div>
77
- {{> ui/row-actions label="Passkey actions" deleteModal="#deletePasskey" deleteId=this.id deleteName=this.name}}
78
- </li>
79
- {{/each}}
80
- </ul>
99
+ {{#if passkeyCount}}
100
+ {{> ui/badge label=(concat passkeyCount " registered") variant="success"}}
81
101
  {{else}}
82
- {{> ui/badge label="None registered" variant="neutral" soft=true}}
102
+ {{> ui/badge label="Not configured" variant="neutral" soft=true}}
83
103
  {{/if}}
84
104
  </div>
85
- <div class="text-end">
86
- {{#if serviceUrl}}
87
- {{> ui/btn label="Add passkey" variant="primary" style="outline" id="register-passkey-btn"
88
- icon="icon-[tabler--fingerprint]"}}
89
- {{else}}
90
- {{#> ui/tooltip text="Set a Service URL in configuration before registering passkeys"}}
91
- {{!-- pointer-events-none: disabled buttons swallow hover, which would keep
92
- the wrapping tooltip from ever showing --}}
93
- <button type="button" class="btn btn-outline btn-neutral pointer-events-none" disabled>
94
- Add passkey
95
- </button>
96
- {{/ui/tooltip}}
97
- <br><small class="text-base-content/60">Requires Service URL</small>
98
- {{/if}}
105
+ <div class="ee-setting-action">
106
+ {{> ui/btn label=(when passkeyCount "Manage passkeys" "Add a passkey") variant="neutral"
107
+ style="soft" icon=(when passkeyCount "icon-[tabler--fingerprint]" "icon-[tabler--plus]")
108
+ href="/admin/account/passkeys"}}
99
109
  </div>
100
110
  </div>
101
111
  </li>
102
112
 
103
113
  <li class="py-4">
104
- <div class="grid grid-cols-3 items-center gap-4">
114
+ <div class="ee-setting-row">
105
115
  <div>Single Sign-On (SSO)</div>
106
116
  <div>
107
117
  {{#if providers.okta}}
@@ -114,14 +124,13 @@
114
124
  {{> ui/badge label="Not configured" variant="neutral" soft=true}}
115
125
  {{/unless}}
116
126
  </div>
117
- {{!-- flex row, not text-end space-y: with two inline buttons on one
118
- line the space-y margin lands on the second button only and
119
- knocks the pair out of vertical alignment --}}
120
- <div class="flex flex-wrap items-center justify-end gap-2">
121
- {{> ui/btn label="Okta setup" variant="primary" style="outline" id="sso-instructions"
122
- overlay="#ssoInstructionsModal"}}
123
- {{> ui/btn label="OIDC setup" variant="primary" style="outline" id="oidc-instructions"
124
- overlay="#oidcInstructionsModal"}}
127
+ {{!-- One button, because neither of these configures anything: SSO is wired
128
+ through environment variables and a restart, so what the row can offer
129
+ is the instructions. Which provider you use is a choice inside them,
130
+ not two peer actions competing with "Enable 2FA" next door. --}}
131
+ <div class="ee-setting-action">
132
+ {{> ui/btn label="Setup instructions" variant="neutral" style="soft"
133
+ icon="icon-[tabler--book]" id="sso-instructions" overlay="#ssoInstructionsModal"}}
125
134
  </div>
126
135
  </div>
127
136
  </li>
@@ -130,22 +139,29 @@
130
139
  </div>
131
140
  </div>
132
141
 
133
- {{#> ui/confirm-modal id="deletePasskey" title="Remove passkey" action="/admin/account/passkeys/delete" fieldName="credentialId" fieldClass="delete-target-id" submitLabel="Remove passkey"}}
134
- Are you sure you want to remove <strong class="delete-target-name"></strong>? You will no longer be able to sign in with this passkey.
135
- {{/ui/confirm-modal}}
136
-
137
142
  {{#> ui/modal id="disableTfaModal" title="Disable two-factor authentication" titleId="disableTfaModalLabel"}}
138
- <div class="modal-body">
139
- <p>Disabling two-factor authentication will make your account less secure. Are you sure you want to continue?</p>
140
- </div>
141
- <div class="modal-footer">
142
- <form method="post" action="/admin/account/tfa/disable" class="flex gap-2">
143
+ <form method="post" action="/admin/account/tfa/disable">
144
+ <div class="modal-body space-y-4">
145
+ <p>Disabling two-factor authentication will make your account less secure. Are you sure you want to continue?</p>
146
+
147
+ <div>
148
+ {{!-- The route verifies this server-side: switching the second factor off is a step
149
+ down that a live session alone must not be able to take, the same rule the
150
+ password change and passkey registration follow --}}
151
+ {{#> ui/form-field id="tfa-disable-password" label="Current password"}}
152
+ <input type="password" class="input" id="tfa-disable-password" name="password" maxlength="256"
153
+ autocomplete="current-password" required />
154
+ <span class="helper-text">Confirm your identity before switching off two-factor authentication.</span>
155
+ {{/ui/form-field}}
156
+ </div>
157
+ </div>
158
+ <div class="modal-footer">
143
159
  <input type="hidden" name="crumb" value="{{crumb}}" />
144
160
  <input type="hidden" name="type" value="totp" />
145
161
  {{> ui/btn label="Cancel" variant="neutral" style="soft" overlay="#disableTfaModal"}}
146
162
  {{> ui/btn label="Disable 2FA" variant="error" type="submit"}}
147
- </form>
148
- </div>
163
+ </div>
164
+ </form>
149
165
  {{/ui/modal}}
150
166
 
151
167
  {{#> ui/modal id="enableTfaModal" title="Enable two-factor authentication" titleId="enableTfaModalLabel"}}
@@ -193,273 +209,249 @@ Are you sure you want to remove <strong class="delete-target-name"></strong>? Yo
193
209
  </form>
194
210
  {{/ui/modal}}
195
211
 
196
- {{#> ui/modal id="ssoInstructionsModal" title="Configure Single Sign-On with Okta" titleId="ssoInstructionsModalLabel"
212
+ {{!-- One dialog with a tab per provider, replacing a pair of modals opened by a pair of
213
+ buttons. OpenID Connect leads because it covers every standards-compliant provider,
214
+ Okta included as a special case of it; Okta keeps its own tab because its variables
215
+ and redirect URI differ. --}}
216
+ {{#> ui/modal id="ssoInstructionsModal" title="Configure Single Sign-On" titleId="ssoInstructionsModalLabel"
197
217
  dialogClass="max-w-5xl"}}
198
218
  <div class="modal-body">
199
219
 
200
- <p class="mb-2">Follow these steps to configure Single Sign-On with Okta:</p>
201
- <ol class="list-decimal ps-6 mb-4 space-y-1">
202
- <li>Create a new web application in your Okta dashboard using the Redirect URI below</li>
203
- <li>Configure the required environment variables for EmailEngine</li>
204
- <li>Restart EmailEngine to apply the changes</li>
205
- </ol>
206
-
207
- <p class="mb-4"><strong>Redirect URI for your Okta application:</strong><br>
208
- <code>{{serviceUrl}}/admin/login/okta</code>
209
- </p>
210
-
211
- <div class="overflow-x-auto">
212
- <table class="table table-sm">
213
- <thead>
214
- <tr>
215
- <th>Environment variable</th>
216
- <th>Current value</th>
217
- </tr>
218
- </thead>
219
- <tbody>
220
- <tr>
221
- <th>
222
- <code>OKTA_OAUTH2_ISSUER</code>
223
- </th>
224
- <td>
225
- {{#if okta.OKTA_OAUTH2_ISSUER}}
226
- <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_ISSUER}}</code>
227
- {{else}}
228
- Not configured (enter your Okta issuer URL)
229
- {{/if}}
230
- </td>
231
- </tr>
232
-
233
- <tr>
234
- <th><code>OKTA_OAUTH2_CLIENT_ID</code></th>
235
- <td>
236
- {{#if okta.OKTA_OAUTH2_CLIENT_ID}}
237
- <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_CLIENT_ID}}</code>
238
- {{else}}
239
- Not configured
240
- {{/if}}
241
- </td>
242
- </tr>
243
-
244
- <tr>
245
- <th><code>OKTA_OAUTH2_CLIENT_SECRET</code></th>
246
- <td>
247
- {{#if okta.OKTA_OAUTH2_CLIENT_SECRET}}
248
- <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_CLIENT_SECRET}}</code>
249
- {{else}}
250
- Not configured
251
- {{/if}}
252
-
253
- </td>
254
- </tr>
255
- </tbody>
256
- </table>
257
- </div>
220
+ {{#> ui/tabs label="Single Sign-On providers" class="mb-4"}}
221
+ {{> ui/tab target="sso-oidc" label="OpenID Connect" active=true}}
222
+ {{> ui/tab target="sso-okta" label="Okta"}}
223
+ {{/ui/tabs}}
224
+
225
+ <div id="sso-oidc" role="tabpanel" aria-labelledby="sso-oidc-tab">
226
+
227
+ <p class="mb-4">EmailEngine works with any standards-compliant OpenID Connect provider - Keycloak, Authentik,
228
+ Azure AD/Entra, Google Workspace, and others. The provider's endpoints are read automatically from
229
+ its discovery document (<code>{{oidc.OIDC_ISSUER}}/.well-known/openid-configuration</code>)
230
+ when EmailEngine starts.</p>
231
+
232
+ <ol class="list-decimal ps-6 mb-4 space-y-1">
233
+ <li>Register a confidential OIDC client (authorization code flow) in your identity provider using the
234
+ Redirect URI below</li>
235
+ <li>Configure the required environment variables for EmailEngine</li>
236
+ <li>Restart EmailEngine to apply the changes</li>
237
+ </ol>
238
+
239
+ <p class="mb-4"><strong>Redirect URI for your OIDC client:</strong><br>
240
+ <code>{{serviceUrl}}/admin/login/oidc</code>
241
+ </p>
242
+
243
+ <div class="overflow-x-auto">
244
+ <table class="table table-sm">
245
+ <thead>
246
+ <tr>
247
+ <th>Environment variable</th>
248
+ <th>Current value</th>
249
+ </tr>
250
+ </thead>
251
+ <tbody>
252
+ <tr>
253
+ <th><code>OIDC_ISSUER</code></th>
254
+ <td>
255
+ {{#if oidc.OIDC_ISSUER}}
256
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_ISSUER}}</code>
257
+ {{else}}
258
+ Not configured (enter your OIDC issuer URL)
259
+ {{/if}}
260
+ </td>
261
+ </tr>
262
+
263
+ <tr>
264
+ <th><code>OIDC_CLIENT_ID</code></th>
265
+ <td>
266
+ {{#if oidc.OIDC_CLIENT_ID}}
267
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_CLIENT_ID}}</code>
268
+ {{else}}
269
+ Not configured
270
+ {{/if}}
271
+ </td>
272
+ </tr>
273
+
274
+ <tr>
275
+ <th><code>OIDC_CLIENT_SECRET</code></th>
276
+ <td>
277
+ {{#if oidc.OIDC_CLIENT_SECRET}}
278
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_CLIENT_SECRET}}</code>
279
+ {{else}}
280
+ Not configured
281
+ {{/if}}
282
+ </td>
283
+ </tr>
284
+
285
+ <tr>
286
+ <th><code>OIDC_PROVIDER_NAME</code><br><small class="text-base-content/60">optional</small></th>
287
+ <td>
288
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_PROVIDER_NAME}}</code>
289
+ <br><small class="text-base-content/60">Label shown on the sign-in button</small>
290
+ </td>
291
+ </tr>
292
+
293
+ <tr>
294
+ <th><code>OIDC_ALLOWED_USERS</code><br><small class="text-base-content/60">optional</small></th>
295
+ <td>
296
+ {{#if oidc.OIDC_ALLOWED_USERS}}
297
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_ALLOWED_USERS}}</code>
298
+ {{else}}
299
+ Not set
300
+ {{/if}}
301
+ <br><small class="text-base-content/60">Comma-separated allow-list of emails and/or
302
+ <code>@domain</code> entries</small>
303
+ </td>
304
+ </tr>
305
+
306
+ <tr>
307
+ <th><code>OIDC_ALLOWED_GROUPS</code><br><small class="text-base-content/60">optional</small></th>
308
+ <td>
309
+ {{#if oidc.OIDC_ALLOWED_GROUPS}}
310
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_ALLOWED_GROUPS}}</code>
311
+ {{else}}
312
+ Not set
313
+ {{/if}}
314
+ <br><small class="text-base-content/60">Comma-separated group names. A user is allowed if their
315
+ email matches <code>OIDC_ALLOWED_USERS</code> OR they belong to
316
+ one of these groups. When both are empty, anyone the identity provider authenticates
317
+ can sign in.</small>
318
+ </td>
319
+ </tr>
320
+
321
+ <tr>
322
+ <th><code>OIDC_GROUPS_CLAIM</code><br><small class="text-base-content/60">optional</small></th>
323
+ <td>
324
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_GROUPS_CLAIM}}</code>
325
+ <br><small class="text-base-content/60">userinfo claim that carries group membership (default
326
+ <code>groups</code>); may be a dotted path such as
327
+ <code>realm_access.roles</code></small>
328
+ </td>
329
+ </tr>
330
+
331
+ <tr>
332
+ <th><code>OIDC_FORCED</code><br><small class="text-base-content/60">optional</small></th>
333
+ <td>
334
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_FORCED}}</code>
335
+ <br><small class="text-base-content/60">When true, the login page redirects straight to the
336
+ identity provider and local password/passkey sign-in is disabled. If discovery fails at
337
+ startup the local form is shown as a fallback, and EmailEngine keeps retrying the
338
+ provider in the background until it answers.</small>
339
+ </td>
340
+ </tr>
341
+
342
+ <tr>
343
+ <th><code>OIDC_LOGOUT</code><br><small class="text-base-content/60">optional</small></th>
344
+ <td>
345
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_LOGOUT}}</code>
346
+ <br><small class="text-base-content/60">When true, signing out also ends the identity-provider
347
+ session (RP-initiated logout via the end_session endpoint).</small>
348
+ </td>
349
+ </tr>
350
+
351
+ <tr>
352
+ <th><code>OIDC_POST_LOGOUT_REDIRECT_URI</code><br><small
353
+ class="text-base-content/60">optional</small></th>
354
+ <td>
355
+ {{#if oidc.OIDC_POST_LOGOUT_REDIRECT_URI}}
356
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_POST_LOGOUT_REDIRECT_URI}}</code>
357
+ {{else}}
358
+ Not set - the identity provider shows its own logged-out page
359
+ {{/if}}
360
+ <br><small class="text-base-content/60">Where the IdP returns after logout (must be a registered
361
+ post logout redirect URI). Point it at
362
+ <code>{{serviceUrl}}/admin/login?loggedout=1</code> for an in-app
363
+ signed-out screen.</small>
364
+ </td>
365
+ </tr>
366
+ </tbody>
367
+ </table>
368
+ </div>
258
369
 
259
- </div>
260
- <div class="modal-footer">
261
- {{> ui/btn label="Close" variant="neutral" style="soft" overlay="#ssoInstructionsModal"}}
262
- </div>
263
- {{/ui/modal}}
370
+ <p class="mb-1"><strong>Keycloak example</strong></p>
371
+ <ul class="list-disc ps-6 mb-4 space-y-1">
372
+ <li>Issuer: <code>https://&lt;keycloak-host&gt;/realms/&lt;realm&gt;</code></li>
373
+ <li>Client type: OpenID Connect, confidential (Client authentication on), Standard Flow enabled</li>
374
+ <li>Valid redirect URI: <code>{{serviceUrl}}/admin/login/oidc</code></li>
375
+ <li>For group-based access: add a <em>Group Membership</em> mapper to the client (Token Claim Name
376
+ <code>groups</code>, "Add to userinfo" enabled), then set
377
+ <code>OIDC_ALLOWED_GROUPS</code></li>
378
+ <li>For return-to-app after logout (optional): set
379
+ <code>OIDC_POST_LOGOUT_REDIRECT_URI</code> and add that URL to the client's
380
+ Valid post logout redirect URIs</li>
381
+ </ul>
264
382
 
265
- {{#> ui/modal id="oidcInstructionsModal" title="Configure Single Sign-On with OIDC" titleId="oidcInstructionsModalLabel"
266
- dialogClass="max-w-5xl"}}
267
- <div class="modal-body">
383
+ <p class="text-base-content/60 text-sm mb-0">Note: signing in via SSO is a standalone factor - TOTP is not
384
+ prompted, and local password/passkey management is disabled for SSO sessions. With
385
+ <code>OIDC_LOGOUT</code> off, signing out clears only the local EmailEngine
386
+ session, not the identity-provider session.</p>
268
387
 
269
- <p class="mb-4">EmailEngine works with any standards-compliant OpenID Connect provider - Keycloak, Authentik,
270
- Azure AD/Entra, Google Workspace, and others. The provider's endpoints are read automatically from
271
- its discovery document (<code>{{oidc.OIDC_ISSUER}}/.well-known/openid-configuration</code>)
272
- when EmailEngine starts.</p>
273
-
274
- <ol class="list-decimal ps-6 mb-4 space-y-1">
275
- <li>Register a confidential OIDC client (authorization code flow) in your identity provider using the
276
- Redirect URI below</li>
277
- <li>Configure the required environment variables for EmailEngine</li>
278
- <li>Restart EmailEngine to apply the changes</li>
279
- </ol>
280
-
281
- <p class="mb-4"><strong>Redirect URI for your OIDC client:</strong><br>
282
- <code>{{serviceUrl}}/admin/login/oidc</code>
283
- </p>
284
-
285
- <div class="overflow-x-auto">
286
- <table class="table table-sm">
287
- <thead>
288
- <tr>
289
- <th>Environment variable</th>
290
- <th>Current value</th>
291
- </tr>
292
- </thead>
293
- <tbody>
294
- <tr>
295
- <th><code>OIDC_ISSUER</code></th>
296
- <td>
297
- {{#if oidc.OIDC_ISSUER}}
298
- <code class="inline-block overflow-hidden">{{oidc.OIDC_ISSUER}}</code>
299
- {{else}}
300
- Not configured (enter your OIDC issuer URL)
301
- {{/if}}
302
- </td>
303
- </tr>
304
-
305
- <tr>
306
- <th><code>OIDC_CLIENT_ID</code></th>
307
- <td>
308
- {{#if oidc.OIDC_CLIENT_ID}}
309
- <code class="inline-block overflow-hidden">{{oidc.OIDC_CLIENT_ID}}</code>
310
- {{else}}
311
- Not configured
312
- {{/if}}
313
- </td>
314
- </tr>
315
-
316
- <tr>
317
- <th><code>OIDC_CLIENT_SECRET</code></th>
318
- <td>
319
- {{#if oidc.OIDC_CLIENT_SECRET}}
320
- <code class="inline-block overflow-hidden">{{oidc.OIDC_CLIENT_SECRET}}</code>
321
- {{else}}
322
- Not configured
323
- {{/if}}
324
- </td>
325
- </tr>
326
-
327
- <tr>
328
- <th><code>OIDC_PROVIDER_NAME</code><br><small class="text-base-content/60">optional</small></th>
329
- <td>
330
- <code class="inline-block overflow-hidden">{{oidc.OIDC_PROVIDER_NAME}}</code>
331
- <br><small class="text-base-content/60">Label shown on the sign-in button</small>
332
- </td>
333
- </tr>
334
-
335
- <tr>
336
- <th><code>OIDC_ALLOWED_USERS</code><br><small class="text-base-content/60">optional</small></th>
337
- <td>
338
- {{#if oidc.OIDC_ALLOWED_USERS}}
339
- <code class="inline-block overflow-hidden">{{oidc.OIDC_ALLOWED_USERS}}</code>
340
- {{else}}
341
- Not set
342
- {{/if}}
343
- <br><small class="text-base-content/60">Comma-separated allow-list of emails and/or
344
- <code>@domain</code> entries</small>
345
- </td>
346
- </tr>
347
-
348
- <tr>
349
- <th><code>OIDC_ALLOWED_GROUPS</code><br><small class="text-base-content/60">optional</small></th>
350
- <td>
351
- {{#if oidc.OIDC_ALLOWED_GROUPS}}
352
- <code class="inline-block overflow-hidden">{{oidc.OIDC_ALLOWED_GROUPS}}</code>
353
- {{else}}
354
- Not set
355
- {{/if}}
356
- <br><small class="text-base-content/60">Comma-separated group names. A user is allowed if their
357
- email matches <code>OIDC_ALLOWED_USERS</code> OR they belong to
358
- one of these groups. When both are empty, anyone the identity provider authenticates
359
- can sign in.</small>
360
- </td>
361
- </tr>
362
-
363
- <tr>
364
- <th><code>OIDC_GROUPS_CLAIM</code><br><small class="text-base-content/60">optional</small></th>
365
- <td>
366
- <code class="inline-block overflow-hidden">{{oidc.OIDC_GROUPS_CLAIM}}</code>
367
- <br><small class="text-base-content/60">userinfo claim that carries group membership (default
368
- <code>groups</code>); may be a dotted path such as
369
- <code>realm_access.roles</code></small>
370
- </td>
371
- </tr>
372
-
373
- <tr>
374
- <th><code>OIDC_FORCED</code><br><small class="text-base-content/60">optional</small></th>
375
- <td>
376
- <code class="inline-block overflow-hidden">{{oidc.OIDC_FORCED}}</code>
377
- <br><small class="text-base-content/60">When true, the login page redirects straight to the
378
- identity provider and local password/passkey sign-in is disabled. If discovery fails at
379
- startup the local form is shown as a fallback.</small>
380
- </td>
381
- </tr>
382
-
383
- <tr>
384
- <th><code>OIDC_LOGOUT</code><br><small class="text-base-content/60">optional</small></th>
385
- <td>
386
- <code class="inline-block overflow-hidden">{{oidc.OIDC_LOGOUT}}</code>
387
- <br><small class="text-base-content/60">When true, signing out also ends the identity-provider
388
- session (RP-initiated logout via the end_session endpoint).</small>
389
- </td>
390
- </tr>
391
-
392
- <tr>
393
- <th><code>OIDC_POST_LOGOUT_REDIRECT_URI</code><br><small
394
- class="text-base-content/60">optional</small></th>
395
- <td>
396
- {{#if oidc.OIDC_POST_LOGOUT_REDIRECT_URI}}
397
- <code class="inline-block overflow-hidden">{{oidc.OIDC_POST_LOGOUT_REDIRECT_URI}}</code>
398
- {{else}}
399
- Not set - the identity provider shows its own logged-out page
400
- {{/if}}
401
- <br><small class="text-base-content/60">Where the IdP returns after logout (must be a registered
402
- post logout redirect URI). Point it at
403
- <code>{{serviceUrl}}/admin/login?loggedout=1</code> for an in-app
404
- signed-out screen.</small>
405
- </td>
406
- </tr>
407
- </tbody>
408
- </table>
409
388
  </div>
410
389
 
411
- <p class="mb-1"><strong>Keycloak example</strong></p>
412
- <ul class="list-disc ps-6 mb-4 space-y-1">
413
- <li>Issuer: <code>https://&lt;keycloak-host&gt;/realms/&lt;realm&gt;</code></li>
414
- <li>Client type: OpenID Connect, confidential (Client authentication on), Standard Flow enabled</li>
415
- <li>Valid redirect URI: <code>{{serviceUrl}}/admin/login/oidc</code></li>
416
- <li>For group-based access: add a <em>Group Membership</em> mapper to the client (Token Claim Name
417
- <code>groups</code>, "Add to userinfo" enabled), then set
418
- <code>OIDC_ALLOWED_GROUPS</code></li>
419
- <li>For return-to-app after logout (optional): set
420
- <code>OIDC_POST_LOGOUT_REDIRECT_URI</code> and add that URL to the client's
421
- Valid post logout redirect URIs</li>
422
- </ul>
423
-
424
- <p class="text-base-content/60 text-sm mb-0">Note: signing in via SSO is a standalone factor - TOTP is not
425
- prompted, and local password/passkey management is disabled for SSO sessions. With
426
- <code>OIDC_LOGOUT</code> off, signing out clears only the local EmailEngine
427
- session, not the identity-provider session.</p>
428
-
429
- </div>
430
- <div class="modal-footer">
431
- {{> ui/btn label="Close" variant="neutral" style="soft" overlay="#oidcInstructionsModal"}}
432
- </div>
433
- {{/ui/modal}}
390
+ <div id="sso-okta" class="hidden" role="tabpanel" aria-labelledby="sso-okta-tab">
391
+
392
+ <p class="mb-2">Follow these steps to configure Single Sign-On with Okta:</p>
393
+ <ol class="list-decimal ps-6 mb-4 space-y-1">
394
+ <li>Create a new web application in your Okta dashboard using the Redirect URI below</li>
395
+ <li>Configure the required environment variables for EmailEngine</li>
396
+ <li>Restart EmailEngine to apply the changes</li>
397
+ </ol>
398
+
399
+ <p class="mb-4"><strong>Redirect URI for your Okta application:</strong><br>
400
+ <code>{{serviceUrl}}/admin/login/okta</code>
401
+ </p>
402
+
403
+ <div class="overflow-x-auto">
404
+ <table class="table table-sm">
405
+ <thead>
406
+ <tr>
407
+ <th>Environment variable</th>
408
+ <th>Current value</th>
409
+ </tr>
410
+ </thead>
411
+ <tbody>
412
+ <tr>
413
+ <th>
414
+ <code>OKTA_OAUTH2_ISSUER</code>
415
+ </th>
416
+ <td>
417
+ {{#if okta.OKTA_OAUTH2_ISSUER}}
418
+ <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_ISSUER}}</code>
419
+ {{else}}
420
+ Not configured (enter your Okta issuer URL)
421
+ {{/if}}
422
+ </td>
423
+ </tr>
424
+
425
+ <tr>
426
+ <th><code>OKTA_OAUTH2_CLIENT_ID</code></th>
427
+ <td>
428
+ {{#if okta.OKTA_OAUTH2_CLIENT_ID}}
429
+ <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_CLIENT_ID}}</code>
430
+ {{else}}
431
+ Not configured
432
+ {{/if}}
433
+ </td>
434
+ </tr>
435
+
436
+ <tr>
437
+ <th><code>OKTA_OAUTH2_CLIENT_SECRET</code></th>
438
+ <td>
439
+ {{#if okta.OKTA_OAUTH2_CLIENT_SECRET}}
440
+ <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_CLIENT_SECRET}}</code>
441
+ {{else}}
442
+ Not configured
443
+ {{/if}}
444
+
445
+ </td>
446
+ </tr>
447
+ </tbody>
448
+ </table>
449
+ </div>
434
450
 
435
- {{#> ui/modal id="registerPasskeyModal" title="Register a new passkey" titleId="registerPasskeyModalLabel"}}
436
- <div class="modal-body space-y-4">
437
- {{#if authData.enabled}}
438
- <div>
439
- {{#> ui/form-field id="passkey-current-password" label="Current password"}}
440
- <input type="password" class="input" id="passkey-current-password" placeholder="Enter your current password"
441
- maxlength="256" autocomplete="current-password" />
442
- <span class="helper-text">Confirm your identity before registering a new passkey.</span>
443
- {{/ui/form-field}}
444
- </div>
445
- {{/if}}
446
- <div>
447
- {{#> ui/form-field id="passkey-name" label="Passkey name"}}
448
- <input type="text" class="input" id="passkey-name" placeholder="e.g., MacBook Touch ID" maxlength="100" />
449
- <span class="helper-text">A friendly name to help you identify this passkey.</span>
450
- {{/ui/form-field}}
451
- </div>
452
- <div id="passkey-register-error" class="text-error text-sm hidden"></div>
453
- <div id="passkey-register-success" class="text-success text-sm hidden">
454
- Passkey registered successfully.
455
451
  </div>
452
+
456
453
  </div>
457
454
  <div class="modal-footer">
458
- <input type="hidden" id="security-crumb" value="{{crumb}}" />
459
- {{> ui/btn label="Cancel" variant="neutral" style="soft" overlay="#registerPasskeyModal"}}
460
- {{> ui/btn label="Register passkey" id="passkey-register-confirm-btn"}}
455
+ {{> ui/btn label="Close" variant="neutral" style="soft" overlay="#ssoInstructionsModal"}}
461
456
  </div>
462
457
  {{/ui/modal}}
463
-
464
- <script src="/static/vendor/simplewebauthn/browser.min.js"></script>
465
- <script src="/static/js/passkey-register.js"></script>