emailengine-app 2.79.5 → 2.79.7

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 (40) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +24 -0
  3. package/data/google-crawlers.json +1 -1
  4. package/lib/api-routes/account-routes.js +6 -3
  5. package/lib/api-routes/behavior-notes.js +6 -3
  6. package/lib/consts.js +4 -2
  7. package/lib/email-client/imap/mailbox.js +32 -8
  8. package/lib/enum-descriptions.js +1 -1
  9. package/lib/passkeys.js +39 -7
  10. package/lib/sso.js +47 -4
  11. package/lib/tools.js +19 -0
  12. package/lib/ui-routes/account-routes.js +9 -1
  13. package/lib/ui-routes/auth-routes.js +158 -62
  14. package/lib/ui-routes/network-config-routes.js +10 -1
  15. package/package.json +21 -21
  16. package/sbom.json +1 -1
  17. package/static/css/flyonui.css +1 -1
  18. package/static/css/src/app.tailwind.css +55 -0
  19. package/static/js/app.js +4 -35
  20. package/static/js/passkey-register.js +50 -1
  21. package/static/js/public.js +128 -0
  22. package/static/js/ui.js +183 -6
  23. package/static/licenses.html +375 -774
  24. package/translations/messages.pot +66 -66
  25. package/views/account/passkeys.hbs +133 -0
  26. package/views/account/security.hbs +300 -319
  27. package/views/accounts/account.hbs +84 -114
  28. package/views/accounts/register/imap-server.hbs +8 -10
  29. package/views/config/document-store/index.hbs +6 -6
  30. package/views/config/license.hbs +4 -1
  31. package/views/config/oauth/app.hbs +1 -1
  32. package/views/config/oauth/edit.hbs +1 -1
  33. package/views/config/oauth/new.hbs +1 -1
  34. package/views/config/webhooks.hbs +7 -6
  35. package/views/partials/gateway_js.hbs +7 -6
  36. package/views/partials/ui/btn.hbs +8 -2
  37. package/views/partials/ui/confirm-modal.hbs +2 -3
  38. package/views/partials/ui/empty-state.hbs +25 -0
  39. package/views/partials/webhooks_editor_functions.hbs +5 -5
  40. package/workers/api.js +56 -18
@@ -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,10 +139,6 @@
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
143
  <div class="modal-body">
139
144
  <p>Disabling two-factor authentication will make your account less secure. Are you sure you want to continue?</p>
@@ -193,273 +198,249 @@ Are you sure you want to remove <strong class="delete-target-name"></strong>? Yo
193
198
  </form>
194
199
  {{/ui/modal}}
195
200
 
196
- {{#> ui/modal id="ssoInstructionsModal" title="Configure Single Sign-On with Okta" titleId="ssoInstructionsModalLabel"
201
+ {{!-- One dialog with a tab per provider, replacing a pair of modals opened by a pair of
202
+ buttons. OpenID Connect leads because it covers every standards-compliant provider,
203
+ Okta included as a special case of it; Okta keeps its own tab because its variables
204
+ and redirect URI differ. --}}
205
+ {{#> ui/modal id="ssoInstructionsModal" title="Configure Single Sign-On" titleId="ssoInstructionsModalLabel"
197
206
  dialogClass="max-w-5xl"}}
198
207
  <div class="modal-body">
199
208
 
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>
209
+ {{#> ui/tabs label="Single Sign-On providers" class="mb-4"}}
210
+ {{> ui/tab target="sso-oidc" label="OpenID Connect" active=true}}
211
+ {{> ui/tab target="sso-okta" label="Okta"}}
212
+ {{/ui/tabs}}
213
+
214
+ <div id="sso-oidc" role="tabpanel" aria-labelledby="sso-oidc-tab">
215
+
216
+ <p class="mb-4">EmailEngine works with any standards-compliant OpenID Connect provider - Keycloak, Authentik,
217
+ Azure AD/Entra, Google Workspace, and others. The provider's endpoints are read automatically from
218
+ its discovery document (<code>{{oidc.OIDC_ISSUER}}/.well-known/openid-configuration</code>)
219
+ when EmailEngine starts.</p>
220
+
221
+ <ol class="list-decimal ps-6 mb-4 space-y-1">
222
+ <li>Register a confidential OIDC client (authorization code flow) in your identity provider using the
223
+ Redirect URI below</li>
224
+ <li>Configure the required environment variables for EmailEngine</li>
225
+ <li>Restart EmailEngine to apply the changes</li>
226
+ </ol>
227
+
228
+ <p class="mb-4"><strong>Redirect URI for your OIDC client:</strong><br>
229
+ <code>{{serviceUrl}}/admin/login/oidc</code>
230
+ </p>
231
+
232
+ <div class="overflow-x-auto">
233
+ <table class="table table-sm">
234
+ <thead>
235
+ <tr>
236
+ <th>Environment variable</th>
237
+ <th>Current value</th>
238
+ </tr>
239
+ </thead>
240
+ <tbody>
241
+ <tr>
242
+ <th><code>OIDC_ISSUER</code></th>
243
+ <td>
244
+ {{#if oidc.OIDC_ISSUER}}
245
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_ISSUER}}</code>
246
+ {{else}}
247
+ Not configured (enter your OIDC issuer URL)
248
+ {{/if}}
249
+ </td>
250
+ </tr>
251
+
252
+ <tr>
253
+ <th><code>OIDC_CLIENT_ID</code></th>
254
+ <td>
255
+ {{#if oidc.OIDC_CLIENT_ID}}
256
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_CLIENT_ID}}</code>
257
+ {{else}}
258
+ Not configured
259
+ {{/if}}
260
+ </td>
261
+ </tr>
262
+
263
+ <tr>
264
+ <th><code>OIDC_CLIENT_SECRET</code></th>
265
+ <td>
266
+ {{#if oidc.OIDC_CLIENT_SECRET}}
267
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_CLIENT_SECRET}}</code>
268
+ {{else}}
269
+ Not configured
270
+ {{/if}}
271
+ </td>
272
+ </tr>
273
+
274
+ <tr>
275
+ <th><code>OIDC_PROVIDER_NAME</code><br><small class="text-base-content/60">optional</small></th>
276
+ <td>
277
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_PROVIDER_NAME}}</code>
278
+ <br><small class="text-base-content/60">Label shown on the sign-in button</small>
279
+ </td>
280
+ </tr>
281
+
282
+ <tr>
283
+ <th><code>OIDC_ALLOWED_USERS</code><br><small class="text-base-content/60">optional</small></th>
284
+ <td>
285
+ {{#if oidc.OIDC_ALLOWED_USERS}}
286
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_ALLOWED_USERS}}</code>
287
+ {{else}}
288
+ Not set
289
+ {{/if}}
290
+ <br><small class="text-base-content/60">Comma-separated allow-list of emails and/or
291
+ <code>@domain</code> entries</small>
292
+ </td>
293
+ </tr>
294
+
295
+ <tr>
296
+ <th><code>OIDC_ALLOWED_GROUPS</code><br><small class="text-base-content/60">optional</small></th>
297
+ <td>
298
+ {{#if oidc.OIDC_ALLOWED_GROUPS}}
299
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_ALLOWED_GROUPS}}</code>
300
+ {{else}}
301
+ Not set
302
+ {{/if}}
303
+ <br><small class="text-base-content/60">Comma-separated group names. A user is allowed if their
304
+ email matches <code>OIDC_ALLOWED_USERS</code> OR they belong to
305
+ one of these groups. When both are empty, anyone the identity provider authenticates
306
+ can sign in.</small>
307
+ </td>
308
+ </tr>
309
+
310
+ <tr>
311
+ <th><code>OIDC_GROUPS_CLAIM</code><br><small class="text-base-content/60">optional</small></th>
312
+ <td>
313
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_GROUPS_CLAIM}}</code>
314
+ <br><small class="text-base-content/60">userinfo claim that carries group membership (default
315
+ <code>groups</code>); may be a dotted path such as
316
+ <code>realm_access.roles</code></small>
317
+ </td>
318
+ </tr>
319
+
320
+ <tr>
321
+ <th><code>OIDC_FORCED</code><br><small class="text-base-content/60">optional</small></th>
322
+ <td>
323
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_FORCED}}</code>
324
+ <br><small class="text-base-content/60">When true, the login page redirects straight to the
325
+ identity provider and local password/passkey sign-in is disabled. If discovery fails at
326
+ startup the local form is shown as a fallback, and EmailEngine keeps retrying the
327
+ provider in the background until it answers.</small>
328
+ </td>
329
+ </tr>
330
+
331
+ <tr>
332
+ <th><code>OIDC_LOGOUT</code><br><small class="text-base-content/60">optional</small></th>
333
+ <td>
334
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_LOGOUT}}</code>
335
+ <br><small class="text-base-content/60">When true, signing out also ends the identity-provider
336
+ session (RP-initiated logout via the end_session endpoint).</small>
337
+ </td>
338
+ </tr>
339
+
340
+ <tr>
341
+ <th><code>OIDC_POST_LOGOUT_REDIRECT_URI</code><br><small
342
+ class="text-base-content/60">optional</small></th>
343
+ <td>
344
+ {{#if oidc.OIDC_POST_LOGOUT_REDIRECT_URI}}
345
+ <code class="inline-block overflow-hidden">{{oidc.OIDC_POST_LOGOUT_REDIRECT_URI}}</code>
346
+ {{else}}
347
+ Not set - the identity provider shows its own logged-out page
348
+ {{/if}}
349
+ <br><small class="text-base-content/60">Where the IdP returns after logout (must be a registered
350
+ post logout redirect URI). Point it at
351
+ <code>{{serviceUrl}}/admin/login?loggedout=1</code> for an in-app
352
+ signed-out screen.</small>
353
+ </td>
354
+ </tr>
355
+ </tbody>
356
+ </table>
357
+ </div>
258
358
 
259
- </div>
260
- <div class="modal-footer">
261
- {{> ui/btn label="Close" variant="neutral" style="soft" overlay="#ssoInstructionsModal"}}
262
- </div>
263
- {{/ui/modal}}
359
+ <p class="mb-1"><strong>Keycloak example</strong></p>
360
+ <ul class="list-disc ps-6 mb-4 space-y-1">
361
+ <li>Issuer: <code>https://&lt;keycloak-host&gt;/realms/&lt;realm&gt;</code></li>
362
+ <li>Client type: OpenID Connect, confidential (Client authentication on), Standard Flow enabled</li>
363
+ <li>Valid redirect URI: <code>{{serviceUrl}}/admin/login/oidc</code></li>
364
+ <li>For group-based access: add a <em>Group Membership</em> mapper to the client (Token Claim Name
365
+ <code>groups</code>, "Add to userinfo" enabled), then set
366
+ <code>OIDC_ALLOWED_GROUPS</code></li>
367
+ <li>For return-to-app after logout (optional): set
368
+ <code>OIDC_POST_LOGOUT_REDIRECT_URI</code> and add that URL to the client's
369
+ Valid post logout redirect URIs</li>
370
+ </ul>
264
371
 
265
- {{#> ui/modal id="oidcInstructionsModal" title="Configure Single Sign-On with OIDC" titleId="oidcInstructionsModalLabel"
266
- dialogClass="max-w-5xl"}}
267
- <div class="modal-body">
372
+ <p class="text-base-content/60 text-sm mb-0">Note: signing in via SSO is a standalone factor - TOTP is not
373
+ prompted, and local password/passkey management is disabled for SSO sessions. With
374
+ <code>OIDC_LOGOUT</code> off, signing out clears only the local EmailEngine
375
+ session, not the identity-provider session.</p>
268
376
 
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
377
  </div>
410
378
 
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}}
379
+ <div id="sso-okta" class="hidden" role="tabpanel" aria-labelledby="sso-okta-tab">
380
+
381
+ <p class="mb-2">Follow these steps to configure Single Sign-On with Okta:</p>
382
+ <ol class="list-decimal ps-6 mb-4 space-y-1">
383
+ <li>Create a new web application in your Okta dashboard using the Redirect URI below</li>
384
+ <li>Configure the required environment variables for EmailEngine</li>
385
+ <li>Restart EmailEngine to apply the changes</li>
386
+ </ol>
387
+
388
+ <p class="mb-4"><strong>Redirect URI for your Okta application:</strong><br>
389
+ <code>{{serviceUrl}}/admin/login/okta</code>
390
+ </p>
391
+
392
+ <div class="overflow-x-auto">
393
+ <table class="table table-sm">
394
+ <thead>
395
+ <tr>
396
+ <th>Environment variable</th>
397
+ <th>Current value</th>
398
+ </tr>
399
+ </thead>
400
+ <tbody>
401
+ <tr>
402
+ <th>
403
+ <code>OKTA_OAUTH2_ISSUER</code>
404
+ </th>
405
+ <td>
406
+ {{#if okta.OKTA_OAUTH2_ISSUER}}
407
+ <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_ISSUER}}</code>
408
+ {{else}}
409
+ Not configured (enter your Okta issuer URL)
410
+ {{/if}}
411
+ </td>
412
+ </tr>
413
+
414
+ <tr>
415
+ <th><code>OKTA_OAUTH2_CLIENT_ID</code></th>
416
+ <td>
417
+ {{#if okta.OKTA_OAUTH2_CLIENT_ID}}
418
+ <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_CLIENT_ID}}</code>
419
+ {{else}}
420
+ Not configured
421
+ {{/if}}
422
+ </td>
423
+ </tr>
424
+
425
+ <tr>
426
+ <th><code>OKTA_OAUTH2_CLIENT_SECRET</code></th>
427
+ <td>
428
+ {{#if okta.OKTA_OAUTH2_CLIENT_SECRET}}
429
+ <code class="inline-block overflow-hidden">{{okta.OKTA_OAUTH2_CLIENT_SECRET}}</code>
430
+ {{else}}
431
+ Not configured
432
+ {{/if}}
433
+
434
+ </td>
435
+ </tr>
436
+ </tbody>
437
+ </table>
438
+ </div>
434
439
 
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
440
  </div>
441
+
456
442
  </div>
457
443
  <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"}}
444
+ {{> ui/btn label="Close" variant="neutral" style="soft" overlay="#ssoInstructionsModal"}}
461
445
  </div>
462
446
  {{/ui/modal}}
463
-
464
- <script src="/static/vendor/simplewebauthn/browser.min.js"></script>
465
- <script src="/static/js/passkey-register.js"></script>