emailengine-app 2.80.1 → 2.81.1

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 (120) hide show
  1. package/.dockerignore +44 -0
  2. package/.github/docker-smoke-test.sh +16 -0
  3. package/.github/workflows/deploy.yml +4 -0
  4. package/.github/workflows/release.yaml +4 -0
  5. package/.github/workflows/test.yml +2 -0
  6. package/.release-please-manifest.json +1 -1
  7. package/CHANGELOG.md +39 -0
  8. package/Dockerfile +17 -9
  9. package/data/google-crawlers.json +1 -1
  10. package/docker-compose.yml +7 -1
  11. package/lib/api-routes/account-routes.js +158 -72
  12. package/lib/api-routes/permission-map.js +6 -1
  13. package/lib/autodetect-imap-settings.js +4 -4
  14. package/lib/sentry.js +13 -2
  15. package/lib/tls/provision.js +1 -1
  16. package/lib/token-permission-view.js +8 -7
  17. package/lib/tools.js +1 -0
  18. package/lib/ui-routes/account-routes.js +195 -61
  19. package/lib/ui-routes/admin-entities-routes.js +9 -9
  20. package/package.json +19 -19
  21. package/sbom.json +1 -1
  22. package/static/css/flyonui.css +1 -1
  23. package/static/css/public.css +41 -0
  24. package/static/css/src/app.tailwind.css +135 -4
  25. package/static/js/public.js +218 -0
  26. package/static/licenses.html +54 -30
  27. package/translations/README.md +4 -3
  28. package/translations/de.mo +0 -0
  29. package/translations/de.po +296 -185
  30. package/translations/en.po +220 -128
  31. package/translations/es.mo +0 -0
  32. package/translations/es.po +558 -0
  33. package/translations/et.mo +0 -0
  34. package/translations/et.po +288 -181
  35. package/translations/fr.mo +0 -0
  36. package/translations/fr.po +295 -183
  37. package/translations/it.mo +0 -0
  38. package/translations/it.po +558 -0
  39. package/translations/ja.mo +0 -0
  40. package/translations/ja.po +268 -192
  41. package/translations/locales.json +24 -0
  42. package/translations/messages.pot +142 -96
  43. package/translations/nl.mo +0 -0
  44. package/translations/nl.po +288 -175
  45. package/translations/pl.mo +0 -0
  46. package/translations/pl.po +294 -181
  47. package/translations/sv.mo +0 -0
  48. package/translations/sv.po +555 -0
  49. package/translations/tr.mo +0 -0
  50. package/translations/tr.po +555 -0
  51. package/update-info.sh +12 -6
  52. package/views/account/login-redirect.hbs +6 -5
  53. package/views/account/passkeys.hbs +6 -6
  54. package/views/account/security.hbs +2 -2
  55. package/views/accounts/account.hbs +17 -19
  56. package/views/accounts/edit.hbs +14 -14
  57. package/views/accounts/index.hbs +3 -3
  58. package/views/accounts/register/imap-server.hbs +26 -172
  59. package/views/accounts/register/validating.hbs +139 -0
  60. package/views/config/ai.hbs +14 -16
  61. package/views/config/branding.hbs +5 -5
  62. package/views/config/document-store/chat.hbs +8 -7
  63. package/views/config/document-store/index.hbs +13 -14
  64. package/views/config/document-store/mappings/index.hbs +5 -6
  65. package/views/config/document-store/mappings/new.hbs +1 -2
  66. package/views/config/document-store/pre-processing/index.hbs +4 -4
  67. package/views/config/email-processing.hbs +6 -6
  68. package/views/config/imap-proxy.hbs +6 -7
  69. package/views/config/license.hbs +8 -8
  70. package/views/config/logging.hbs +5 -7
  71. package/views/config/mcp.hbs +14 -18
  72. package/views/config/network.hbs +3 -3
  73. package/views/config/oauth/app.hbs +10 -10
  74. package/views/config/oauth/index.hbs +6 -6
  75. package/views/config/oauth/subscriptions.hbs +9 -9
  76. package/views/config/security.hbs +5 -7
  77. package/views/config/service.hbs +10 -9
  78. package/views/config/smtp.hbs +8 -11
  79. package/views/config/tls-upload.hbs +3 -3
  80. package/views/config/tls.hbs +33 -35
  81. package/views/config/webhooks.hbs +10 -13
  82. package/views/dashboard.hbs +9 -8
  83. package/views/gateways/edit.hbs +3 -3
  84. package/views/gateways/gateway.hbs +3 -3
  85. package/views/gateways/index.hbs +6 -6
  86. package/views/gateways/new.hbs +3 -3
  87. package/views/internals/index.hbs +14 -12
  88. package/views/layout/login.hbs +27 -14
  89. package/views/layout/prompt.hbs +12 -15
  90. package/views/mcp/authorize.hbs +1 -1
  91. package/views/partials/accounts_table.hbs +5 -5
  92. package/views/partials/add_account_modal.hbs +3 -3
  93. package/views/partials/address_list.hbs +4 -4
  94. package/views/partials/gateway_form.hbs +5 -5
  95. package/views/partials/mcp_account_limit.hbs +2 -2
  96. package/views/partials/oauth_config_header.hbs +2 -2
  97. package/views/partials/oauth_form.hbs +36 -41
  98. package/views/partials/public_alerts.hbs +1 -1
  99. package/views/partials/public_test_labels.hbs +15 -0
  100. package/views/partials/security_header.hbs +2 -2
  101. package/views/partials/template_form.hbs +3 -3
  102. package/views/partials/tls_security_card.hbs +4 -1
  103. package/views/partials/ui/form-field.hbs +6 -1
  104. package/views/partials/ui/setting-ref.hbs +12 -7
  105. package/views/partials/ui/stat-card.hbs +4 -1
  106. package/views/partials/ui/tabs.hbs +3 -7
  107. package/views/partials/webhook_form.hbs +9 -12
  108. package/views/reference/index.hbs +2 -2
  109. package/views/reference/token.hbs +3 -3
  110. package/views/suppression-lists/index.hbs +8 -6
  111. package/views/suppression-lists/list.hbs +13 -8
  112. package/views/templates/edit.hbs +1 -1
  113. package/views/templates/index.hbs +10 -11
  114. package/views/templates/template.hbs +4 -4
  115. package/views/tokens/index.hbs +17 -17
  116. package/views/tokens/new.hbs +18 -22
  117. package/views/webhooks/edit.hbs +1 -1
  118. package/views/webhooks/index.hbs +10 -11
  119. package/views/webhooks/new.hbs +1 -1
  120. package/views/webhooks/webhook.hbs +4 -5
@@ -40,7 +40,7 @@
40
40
  id="request-reconnect" disabled=accountParked}}
41
41
  {{/ui/tooltip}}
42
42
 
43
- {{#> ui/tooltip text="Run periodic folder syncing now"}}
43
+ {{#> ui/tooltip text="Sync folders now without waiting for the next scheduled sync"}}
44
44
  <button type="button" class="btn btn-soft btn-sm" id="request-sync">
45
45
  <span class="icon-[tabler--rotate-clockwise] size-4"></span> Run sync
46
46
  </button>
@@ -85,7 +85,7 @@
85
85
  aria-orientation="vertical">
86
86
  {{#if canUseSmtp}}
87
87
  <li><button type="button" class="dropdown-item test-send-trigger"
88
- data-account="{{account.account}}">Account's Mail server</button></li>
88
+ data-account="{{account.account}}">Account mail server</button></li>
89
89
  <li>
90
90
  <div class="divider my-1"></div>
91
91
  </li>
@@ -397,7 +397,7 @@
397
397
  <div class="grid gap-6 {{#if showSmtp}}lg:grid-cols-2 {{/if}}items-start mb-6">
398
398
 
399
399
  <div class="card bg-base-100 shadow-md">
400
- <div class="card-header"><h6 class="card-title text-primary">IMAP {{#if account.lastErrorState}}<span class="badge badge-error badge-sm">errored</span>{{/if}}</h6>
400
+ <div class="card-header"><h6 class="card-title text-primary">IMAP {{#if account.lastErrorState}}<span class="badge badge-error badge-sm">Error</span>{{/if}}</h6>
401
401
  </div>
402
402
  <div class="card-body">
403
403
 
@@ -480,7 +480,7 @@
480
480
  {{/unless}}
481
481
 
482
482
  {{#if account.imap.resyncDelay}}
483
- <dt>Resync delay</dt>
483
+ <dt>Resync interval (seconds)</dt>
484
484
  <dd>{{account.imap.resyncDelay}}</dd>
485
485
  {{/if}}
486
486
 
@@ -513,10 +513,8 @@
513
513
  <hr>
514
514
  <h6 class="card-title text-primary">Subconnections</h6>
515
515
 
516
- <p>Subconnections are supplementary IMAP connections that help detect changes in secondary folders more quickly.
517
- By default, EmailEngine only receives real-time updates for the primary folder and uses periodic
518
- polling for secondary folders. However, when faster updates are required from
519
- secondary folders, subconnections can be used to ensure prompt notifications.</p>
516
+ <p>Subconnections are additional IMAP connections that watch secondary folders for changes.
517
+ They provide faster updates than the periodic sync used for these folders by default.</p>
520
518
 
521
519
  <dl class="ee-dl mt-4">
522
520
  {{#each subConnectionInfo}}
@@ -533,7 +531,7 @@
533
531
 
534
532
  {{#if showSmtp}}
535
533
  <div class="card bg-base-100 shadow-md">
536
- <div class="card-header"><h6 class="card-title text-primary">SMTP {{#if smtpError}}<span class="badge badge-error badge-sm">errored</span>{{/if}}</h6>
534
+ <div class="card-header"><h6 class="card-title text-primary">SMTP {{#if smtpError}}<span class="badge badge-error badge-sm">Error</span>{{/if}}</h6>
537
535
  </div>
538
536
  <div class="card-body">
539
537
 
@@ -760,7 +758,7 @@
760
758
  <span class="text-base-content/60">None selected - the default target receives no events</span>
761
759
  {{/if}}
762
760
  {{#if webhookRouting.defaultRoute.inboxNewOnly}}
763
- <div><small>New-message notifications are limited to INBOX (<em>inboxNewOnly</em>).</small></div>
761
+ <div><small>New-message notifications are limited to the Inbox (<code>inboxNewOnly</code>).</small></div>
764
762
  {{/if}}
765
763
  </dd>
766
764
  {{/if}}
@@ -789,7 +787,7 @@
789
787
  {{#if account.webhookErrorFlag.message}}
790
788
  <hr />
791
789
 
792
- <div><small><strong>Note:</strong> The last webhook attempt failed with the following response.</small></div>
790
+ <div><small>The last webhook delivery attempt failed:</small></div>
793
791
  <div><code>{{account.webhookErrorFlag.message}}</code></div>
794
792
  {{/if}}
795
793
 
@@ -820,26 +818,26 @@
820
818
  </div>
821
819
  {{/ui/modal}}
822
820
 
823
- {{#> ui/confirm-modal id="deleteModal" title="Delete Account" action=(concat "/admin/accounts/" (urlpart account.account) "/delete")
821
+ {{#> ui/confirm-modal id="deleteModal" title="Delete account" action=(concat "/admin/accounts/" (urlpart account.account) "/delete")
824
822
  submitLabel="Delete account"}}
825
- <p>Are you sure you want to delete the account for {{account.name}}? This action cannot be undone.</p>
823
+ <p>Delete <strong>{{account.name}}</strong> from EmailEngine? This removes its synced data, account-specific templates, access tokens, and queued emails. Emails on the mail server are not deleted. This action cannot be undone.</p>
826
824
  {{/ui/confirm-modal}}
827
825
 
828
826
  {{#> ui/modal id="testSendModal" title="Email delivery test" dialogClass="max-w-3xl"}}
829
827
  <div class="modal-body">
830
828
  <p><small class="text-base-content/60">EmailEngine sends a test email from the selected account to EmailEngine's
831
829
  remote testing server. Once the test email has been processed, EmailEngine displays the
832
- authorization validation results below.</small>
830
+ SPF, DKIM, and DMARC authentication results below.</small>
833
831
  </p>
834
832
  <div id="test-send-pending-message">
835
- <p><span class="loading loading-spinner loading-sm align-middle"></span> Testing email delivery settings, please
833
+ <p><span class="loading loading-spinner loading-sm align-middle"></span> Testing email delivery. Please
836
834
  wait&mldr;<br />
837
835
  <small><strong>Note:</strong> This process may take several
838
836
  minutes depending on the SMTP server.</small>
839
837
  </p>
840
838
  </div>
841
839
  <div id="test-send-error">
842
- <p>Message submission failed with the following result:</p>
840
+ <p>The test email could not be submitted:</p>
843
841
  <div>
844
842
  <small class="alert alert-soft alert-error error-message block font-mono"></small>
845
843
  </div>
@@ -932,7 +930,7 @@ submitLabel="Delete account"}}
932
930
  </div>
933
931
  <div id="export-download-section" class="hidden mt-4">
934
932
  <a href="#" id="export-download-link" class="btn btn-success btn-block">
935
- <span class="icon-[tabler--download] size-4"></span> Download Export
933
+ <span class="icon-[tabler--download] size-4"></span> Download export
936
934
  </a>
937
935
  </div>
938
936
  </div>
@@ -943,7 +941,7 @@ submitLabel="Delete account"}}
943
941
  <span class="icon-[tabler--trash] size-4"></span> Reset
944
942
  </button>
945
943
  <button type="button" class="btn btn-primary" id="export-start-btn">
946
- <span class="icon-[tabler--file-export] size-4"></span> Start Export
944
+ <span class="icon-[tabler--file-export] size-4"></span> Start export
947
945
  </button>
948
946
  </div>
949
947
  {{/ui/modal}}
@@ -1466,4 +1464,4 @@ submitLabel="Delete account"}}
1466
1464
  aborted = true;
1467
1465
  });
1468
1466
  })
1469
- </script>
1467
+ </script>
@@ -13,9 +13,9 @@
13
13
 
14
14
  <div class="card-body space-y-4">
15
15
 
16
- {{> ui/form-field id="name" label="Full name" value=values.name error=errors.name hint="Full name of the user"}}
17
- {{> ui/form-field id="email" type="email" label="Email" value=values.email error=errors.email hint="Email address of the user"}}
18
- {{> ui/form-field id="expectedEmail" type="email" label="Expected identity" value=values.expectedEmail error=errors.expectedEmail hint="Optional. Setups through the hosted authentication form are rejected unless the identity they authenticate matches this address. Clear the field to remove the restriction."}}
16
+ {{> ui/form-field id="name" label="Full name" value=values.name error=errors.name hint="Name shown for this account in EmailEngine."}}
17
+ {{> ui/form-field id="email" type="email" label="Email address" value=values.email error=errors.email hint="Email address associated with this account."}}
18
+ {{> ui/form-field id="expectedEmail" type="email" label="Restrict sign-in to email (optional)" value=values.expectedEmail error=errors.expectedEmail hint="The hosted authentication form only accepts sign-ins that match this address. Leave blank to remove this restriction."}}
19
19
 
20
20
  </div>
21
21
  </div>
@@ -38,12 +38,12 @@
38
38
 
39
39
  {{> ui/form-field id="imap_auth_user" label="Username" value=values.imap_auth_user error=errors.imap_auth_user lpignore=true required=true}}
40
40
 
41
- {{> ui/form-field id="imap_auth_pass" type="password" label="Password" value=values.imap_auth_pass error=errors.imap_auth_pass lpignore=true placeholder=(when hasIMAPPass "Password is set but not shown...") hint="Only set if you want to change the current IMAP password"}}
41
+ {{> ui/form-field id="imap_auth_pass" type="password" label="Password" value=values.imap_auth_pass error=errors.imap_auth_pass lpignore=true placeholder=(when hasIMAPPass "Password saved") hint="Leave blank to keep the current IMAP password."}}
42
42
 
43
43
  {{> ui/form-field id="imap_host" label="Hostname" value=values.imap_host error=errors.imap_host lpignore=true required=true}}
44
44
  {{> ui/form-field id="imap_port" type="number" label="Port" value=values.imap_port error=errors.imap_port lpignore=true required=true}}
45
45
 
46
- {{> ui/checkbox id="imap_secure" label="Use TLS" checked=values.imap_secure error=errors.imap_secure tooltip="TLS (also known as SSL) is usually only needed when using port 993. For other ports EmailEngine falls back to using STARTTLS based encryption."}}
46
+ {{> ui/checkbox id="imap_secure" label="Use direct TLS" checked=values.imap_secure error=errors.imap_secure tooltip="Usually enabled for port 993. When disabled, EmailEngine uses STARTTLS if the server supports it."}}
47
47
 
48
48
  {{> ui/checkbox id="imap_tls_ignoreCertErrors" label="Allow invalid certificates" checked=values.imap_tls_ignoreCertErrors error=errors.imap_tls_ignoreCertErrors tooltip="Accept self-signed or otherwise invalid TLS certificates when connecting to the IMAP server of this account. The Allow Insecure Email Certificates option on the Security configuration page applies the same override to all accounts."}}
49
49
 
@@ -51,13 +51,13 @@
51
51
 
52
52
  {{/unless}}
53
53
 
54
- {{> ui/form-field id="imap_sentMailPath" label="Sent Mail folder" value=values.imap_sentMailPath error=errors.imap_sentMailPath lpignore=true placeholder='Folder path like "Sent Mail"' list="available-paths-list" hint='Copies of sent emails will be uploaded to this folder. Leave empty to use the default "Sent Mail" folder for this account.'}}
54
+ {{> ui/form-field id="imap_sentMailPath" label="Sent Mail folder" value=values.imap_sentMailPath error=errors.imap_sentMailPath lpignore=true placeholder='Folder path like "Sent Mail"' list="available-paths-list" hint='Store copies of sent emails in this folder. Leave blank to use the default "Sent Mail" folder for this account.'}}
55
55
 
56
- {{> ui/form-field id="imap_resyncDelay" type="number" label="Resync delay" value=values.imap_resyncDelay error=errors.imap_resyncDelay lpignore=true hint="Keep empty for default"}}
56
+ {{> ui/form-field id="imap_resyncDelay" type="number" label="Resync interval (seconds)" value=values.imap_resyncDelay error=errors.imap_resyncDelay lpignore=true hint="Time between full mailbox syncs. Leave blank to keep the current interval."}}
57
57
 
58
58
  {{/unless}}
59
59
 
60
- {{> ui/checkbox id="imap_disabled" label="Disable IMAP" checked=values.imap_disabled error=errors.imap_disabled tooltip="Disable IMAP if you are using this email account only for sending emails."}}
60
+ {{> ui/checkbox id="imap_disabled" label="Disable IMAP" checked=values.imap_disabled error=errors.imap_disabled tooltip="Stop syncing this mailbox while keeping the account available for sending email."}}
61
61
 
62
62
  </div>
63
63
  </div>
@@ -76,12 +76,12 @@
76
76
 
77
77
  {{> ui/form-field id="smtp_auth_user" label="Username" value=values.smtp_auth_user error=errors.smtp_auth_user lpignore=true required=true}}
78
78
 
79
- {{> ui/form-field id="smtp_auth_pass" type="password" label="Password" value=values.smtp_auth_pass error=errors.smtp_auth_pass lpignore=true placeholder=(when hasSMTPPass "Password is set but not shown...") hint="Only set if you want to change the current SMTP password"}}
79
+ {{> ui/form-field id="smtp_auth_pass" type="password" label="Password" value=values.smtp_auth_pass error=errors.smtp_auth_pass lpignore=true placeholder=(when hasSMTPPass "Password saved") hint="Leave blank to keep the current SMTP password."}}
80
80
 
81
81
  {{> ui/form-field id="smtp_host" label="Hostname" value=values.smtp_host error=errors.smtp_host lpignore=true required=true}}
82
82
  {{> ui/form-field id="smtp_port" type="number" label="Port" value=values.smtp_port error=errors.smtp_port lpignore=true required=true}}
83
83
 
84
- {{> ui/checkbox id="smtp_secure" label="Use TLS" checked=values.smtp_secure error=errors.smtp_secure tooltip="TLS (also known as SSL) is usually only needed when using port 465. For other ports EmailEngine falls back to using STARTTLS based encryption."}}
84
+ {{> ui/checkbox id="smtp_secure" label="Use direct TLS" checked=values.smtp_secure error=errors.smtp_secure tooltip="Usually enabled for port 465. When disabled, EmailEngine uses STARTTLS if the server supports it."}}
85
85
 
86
86
  {{> ui/checkbox id="smtp_tls_ignoreCertErrors" label="Allow invalid certificates" checked=values.smtp_tls_ignoreCertErrors error=errors.smtp_tls_ignoreCertErrors tooltip="Accept self-signed or otherwise invalid TLS certificates when connecting to the SMTP server of this account. The Allow Insecure Email Certificates option on the Security configuration page applies the same override to all accounts."}}
87
87
 
@@ -99,7 +99,7 @@
99
99
 
100
100
  <div class="card-body space-y-4">
101
101
 
102
- {{#> ui/form-field id="proxy" label="Proxy URL" error=errors.proxy hint="Fill this if you want to use a custom proxy for this account. Proxy URL must start with http://, https://, socks://, socks4:// or socks5://"}}
102
+ {{#> ui/form-field id="proxy" label="Proxy URL" error=errors.proxy hint="Use a custom proxy for this account. Start the URL with http://, https://, socks://, socks4://, or socks5://."}}
103
103
  <input type="text" class="input or-else-all{{#if errors.proxy}} is-invalid{{/if}}" id="proxy"
104
104
  placeholder="Connection URL like &quot;socks://localhost:1080&quot;&mldr;" value="{{values.proxy}}"
105
105
  name="proxy" data-target="proxy-status">
@@ -107,7 +107,7 @@
107
107
 
108
108
  <div>
109
109
  {{> ui/setting-ref name="smtpEhloName"}}
110
- {{> ui/form-field id="smtpEhloName" label="SMTP Greeting Hostname" value=values.smtpEhloName error=errors.smtpEhloName placeholder='Proxy hostname like "my.proxy.tld"...'}}
110
+ {{> ui/form-field id="smtpEhloName" label="SMTP greeting hostname" value=values.smtpEhloName error=errors.smtpEhloName placeholder="mail.example.com"}}
111
111
  <span class="helper-text">Hostname to use for the SMTP EHLO/HELO greeting. Leave empty to use the
112
112
  default <code>{{defaultSmtpEhloName}}</code>. If you are using a dedicated IP address, the hostname
113
113
  of that IP is preferred over this value.</span>
@@ -123,7 +123,7 @@
123
123
  clear.</span>
124
124
  {{/ui/form-field}}
125
125
 
126
- {{#> ui/form-field id="customHeaders" label="List of custom webhook request headers" error=errors.customHeaders hint="Keep one header per line. These headers will be added to the HTTP request when posting webhooks for this email account."}}
126
+ {{#> ui/form-field id="customHeaders" label="Custom webhook headers" error=errors.customHeaders hint="Enter one header per line in Header-Name: value format. These headers are sent with webhooks for this account."}}
127
127
  <textarea class="textarea font-mono w-full{{#if errors.customHeaders}} is-invalid{{/if}}" id="customHeaders"
128
128
  name="customHeaders" rows="5" spellcheck="false" data-enable-grammarly="false"
129
129
  placeholder="Custom headers like &quot;Authorization: Bearer secret_token&quot;&mldr;">{{values.customHeaders}}</textarea>
@@ -133,7 +133,7 @@
133
133
  </div>
134
134
 
135
135
  <div class="mb-6">
136
- {{> ui/btn label="Update account" type="submit" icon="icon-[tabler--device-floppy]"}}
136
+ {{> ui/btn label="Save changes" type="submit" icon="icon-[tabler--device-floppy]"}}
137
137
  </div>
138
138
  </form>
139
139
 
@@ -1,5 +1,5 @@
1
- {{#> ui/page-header title="Accounts" icon="icon-[tabler--users]" subtitle="Email accounts connected to EmailEngine for syncing and sending mail." badgeLabel=total badgeVariant="neutral" class="mb-6"}}
2
- {{> ui/btn label="Add an account" icon="icon-[tabler--user-plus]" overlay="#addAccount"}}
1
+ {{#> ui/page-header title="Accounts" icon="icon-[tabler--users]" subtitle="Connect and manage email accounts for syncing and sending email." badgeLabel=total badgeVariant="neutral" class="mb-6"}}
2
+ {{> ui/btn label="Add account" icon="icon-[tabler--user-plus]" overlay="#addAccount"}}
3
3
  {{/ui/page-header}}
4
4
 
5
5
  {{> ui/search-crumb parentHref="/admin/accounts" parentLabel="Accounts" query=query}}
@@ -11,7 +11,7 @@
11
11
  {{/if}}
12
12
 
13
13
  {{#> ui/delete-modal id="deleteAccount" noun="account" action="/admin/accounts"}}
14
- Are you sure you want to delete <strong class="delete-target-name"></strong>? All synced data for this account will be removed and this action cannot be undone.
14
+ Delete <strong class="delete-target-name"></strong> from EmailEngine? This removes its synced data, account-specific templates, access tokens, and queued emails. Emails on the mail server are not deleted. This action cannot be undone.
15
15
  {{/ui/delete-modal}}
16
16
 
17
17
  {{>add_account_modal}}
@@ -15,7 +15,7 @@ dropdown allows skipping the test. --}}
15
15
  submission - the payload schemas stripUnknown any posted copy. Do not reintroduce hidden
16
16
  inputs for them: echoing a client-controlled hint into the page was an XSS vector. --}}
17
17
 
18
- <input type="hidden" id="tz" name="tz" value="{{values.tz}}">
18
+ <input type="hidden" id="tz" name="tz" value="{{values.tz}}" data-ee-tz>
19
19
 
20
20
  {{#if autodetectFailed}}
21
21
  <div class="ee-alert ee-alert-info">
@@ -25,6 +25,17 @@ dropdown allows skipping the test. --}}
25
25
  </div>
26
26
  {{/if}}
27
27
 
28
+ {{!-- Set when the checking page sent the visitor here because its connection check did not pass,
29
+ so the form says what it is for instead of appearing out of nowhere. The per-protocol detail stays
30
+ on the page they read it on. --}}
31
+ {{#if checkFailed}}
32
+ <div class="ee-alert ee-alert-warning">
33
+ <span class="ee-icon ee-icon-alert-circle"></span>
34
+ <span>{{_ "We couldn't sign in to your mail server with those settings. Check them and try again."
35
+ templateLocale }}</span>
36
+ </div>
37
+ {{/if}}
38
+
28
39
  <div class="ee-form-grid">
29
40
  <div class="ee-form-col">
30
41
  <h6>{{_ "IMAP" templateLocale }}</h6>
@@ -256,7 +267,7 @@ dropdown allows skipping the test. --}}
256
267
  <details class="ee-dropdown">
257
268
  <summary id="submit-settings-btn-down" class="ee-btn ee-btn-neutral ee-dropdown-toggle"
258
269
  aria-haspopup="menu">
259
- <span class="ee-sr-only">Toggle Dropdown</span>
270
+ <span class="ee-sr-only">{{_ "Toggle Dropdown" templateLocale }}</span>
260
271
  <span class="ee-icon ee-icon-chevron-down"></span>
261
272
  </summary>
262
273
  <ul class="ee-dropdown-menu" role="menu" aria-labelledby="submit-settings-btn-down">
@@ -274,7 +285,7 @@ focus ring on) the corner close button --}}
274
285
  <dialog id="testResponseModal" class="ee-modal ee-modal-wide" aria-labelledby="testResponseModalLabel" autofocus>
275
286
  <div class="ee-modal-header">
276
287
  <h3 class="ee-modal-title" id="testResponseModalLabel">{{_ "Connection test failed" templateLocale }}</h3>
277
- <button type="button" class="ee-modal-close" aria-label="Close" data-modal-close>
288
+ <button type="button" class="ee-modal-close" aria-label="{{_ "Close" templateLocale }}" data-modal-close>
278
289
  <span class="ee-icon ee-icon-x"></span>
279
290
  </button>
280
291
  </div>
@@ -303,139 +314,19 @@ focus ring on) the corner close button --}}
303
314
  let submitDownElm = document.getElementById('submit-settings-btn-down')
304
315
  let errorsListElm = document.getElementById('test-errors-list')
305
316
 
306
- // eeButtonBusy() below is feedback only: it greys the real submit <button> out and spins its
307
- // icon while a submit is in flight, so the wait for the account to be created is visible (the
308
- // dropdown toggle is a <summary> and the skip link an <a>, neither has disabled semantics).
309
- // The actual duplicate-submit guard is the formSubmitting latch in submitForm(), which every
310
- // path routes through - this form submits through myForm.submit(), which fires no submit
311
- // event, so the shared guard in static/js/public.js never sees it.
312
- let formSubmitting = false;
313
- let submitRecoveryTimer = null;
314
- let resetSubmitGuard = () => {
315
- formSubmitting = false;
316
- if (submitRecoveryTimer) {
317
- clearTimeout(submitRecoveryTimer);
318
- submitRecoveryTimer = null;
319
- }
320
- eeButtonBusy(submitElm, false);
321
- };
322
- let submitForm = () => {
323
- // The server claims a single-use nonce, so a second POST from a double-click loses the race and
324
- // renders a 403 even though the first request created the account. Submit at most once and
325
- // disable the submit controls so a duplicate submission cannot fire.
326
- if (formSubmitting) {
327
- return;
328
- }
329
- // myForm.submit() below bypasses HTML5 constraint validation (unlike a real submit button), so
330
- // run it explicitly - otherwise a cleared required field round-trips to the server, 400s, and the
331
- // re-render wipes the password fields. Bail (without latching the guard) so the user can fix it.
332
- if (!myForm.reportValidity()) {
333
- return;
334
- }
335
- formSubmitting = true;
336
- eeButtonBusy(submitElm, true);
337
- // Recovery timer for an aborted submit: a successful submit navigates away (this page and the
338
- // timer are discarded) and a validation error reloads the page fresh, so this only fires when the
339
- // navigation never happened - the user cancelled it (Esc / Stop) while the page stayed alive. There
340
- // is no DOM event for an aborted navigation, so without this the one-shot guard would leave the form
341
- // permanently unsubmittable. Re-enabling is safe: the server's single-use nonce is the real
342
- // double-submit guard, so at worst a later duplicate POST is rejected server-side. The delay is a
343
- // generous upper bound on a create round trip so it never re-arms a genuinely in-flight submit.
344
- submitRecoveryTimer = setTimeout(resetSubmitGuard, 20 * 1000);
345
- myForm.submit();
346
- };
347
-
348
- // Reset the one-shot guard when the page is restored from the back-forward cache (Back after a
349
- // submit): bfcache keeps JS state, so without this the flag stays set and the buttons stay disabled,
350
- // permanently deadening the form.
351
- window.addEventListener('pageshow', e => {
352
- if (!e.persisted) {
353
- return;
354
- }
355
- resetSubmitGuard();
356
- });
357
-
358
- let appendLinkified = (parentElm, text) => {
359
- // Split on URLs and append text nodes + anchors via DOM APIs so server-provided text is
360
- // never parsed as HTML (avoids an innerHTML injection sink).
361
- let parts = String(text == null ? '' : text).split(/(https?:\/\/[^\s]+)/g);
362
- for (let part of parts) {
363
- if (/^https?:\/\//.test(part)) {
364
- let a = document.createElement('a');
365
- a.href = part;
366
- a.target = '_blank';
367
- a.rel = 'noopener noreferrer';
368
- a.textContent = part;
369
- parentElm.appendChild(a);
370
- } else if (part) {
371
- parentElm.appendChild(document.createTextNode(part));
372
- }
373
- }
374
- }
375
-
376
- let addErrorRow = (type, text, extraLabel, extraText) => {
377
- let keyElm = document.createElement('dt');
378
- let valueContainerElm = document.createElement('dd');
379
- let valueElm = document.createElement('div');
380
-
381
- valueElm.classList.add('ee-error-text')
382
-
383
- keyElm.textContent = type;
384
- valueElm.textContent = text;
385
-
386
- valueContainerElm.append(valueElm);
387
-
388
- errorsListElm.appendChild(keyElm);
389
- errorsListElm.appendChild(valueContainerElm);
390
-
391
- if (extraLabel && extraText) {
392
-
393
- let extraLabelElm = document.createElement('div');
394
- extraLabelElm.textContent = extraLabel;
395
-
396
- let extraTextElm = document.createElement('small');
397
- appendLinkified(extraTextElm, extraText);
317
+ {{!-- The busy button is feedback only: it greys the real submit <button> out and spins its
318
+ icon while a submit is in flight, so the wait for the account to be created is visible (the
319
+ dropdown toggle is a <summary> and the skip link an <a>, neither has disabled semantics).
320
+ The duplicate-submit guard is inside eeSubmitOnce (static/js/public.js), which every submit
321
+ path here routes through. --}}
322
+ let submitForm = eeSubmitOnce(myForm, { button: submitElm, validate: true, recoveryMs: 20 * 1000 });
398
323
 
399
- valueContainerElm.appendChild(extraLabelElm);
400
- valueContainerElm.appendChild(extraTextElm);
401
- }
402
- }
324
+ {{!-- Both the row layout and the three response shapes it has to tell apart are shared with
325
+ the checking page (static/js/public.js); only what happens after belongs to this page. --}}
326
+ {{> public_test_labels}}
403
327
 
404
328
  let showErrorPopup = (data) => {
405
- data = data || {}
406
-
407
- errorsListElm.innerHTML = '';
408
-
409
- if (data.error && !data.fields) {
410
- // A Hapi/Boom error body carries the human-readable text in data.message and only the
411
- // status name in data.error ('Forbidden', 'Too Many Requests'); the client-side catch
412
- // path passes { error: Error } instead, hence the fallbacks.
413
- addErrorRow(`{{_ "Error" templateLocale }}`, data.message || data.error.message || data.error)
414
- } else if (data.fields) {
415
- addErrorRow(`{{_ "Invalid settings" templateLocale }}`, data.message);
416
- for (let field of data.fields) {
417
- addErrorRow('-', field.message);
418
- }
419
- } else {
420
- if (!data.imap || !data.imap.success) {
421
- let error = data.imap && data.imap.error || `{{_ "Couldn't connect to IMAP server" templateLocale }}`
422
- if (data.imap && data.imap.responseText) {
423
- addErrorRow('IMAP', error, `{{_ "Server response:" templateLocale }}`, data.imap.responseText);
424
- } else {
425
- addErrorRow('IMAP', error);
426
- }
427
- }
428
-
429
- if (!data.smtp || !data.smtp.success) {
430
- let error = data.smtp && data.smtp.error || `{{_ "Couldn't connect to SMTP server" templateLocale }}`
431
- if (data.smtp && data.smtp.responseText) {
432
- addErrorRow('SMTP', error, `{{_ "Server response:" templateLocale }}`, data.smtp.responseText);
433
- } else {
434
- addErrorRow('SMTP', error);
435
- }
436
- }
437
- }
438
-
329
+ eeRenderTestErrors(errorsListElm, data, TEST_ERROR_LABELS);
439
330
  document.getElementById('testResponseModal').showModal();
440
331
  }
441
332
 
@@ -464,35 +355,7 @@ focus ring on) the corner close button --}}
464
355
  }
465
356
  }
466
357
 
467
- let testSettings = async () => {
468
- let formData = new FormData(myForm);
469
- let body = {}
470
- for (var pair of formData.entries()) {
471
- body[pair[0]] = pair[1];
472
- }
473
-
474
- const res = await fetch('/accounts/new/imap/test', {
475
- method: 'post',
476
- headers: { 'content-type': 'application/json' },
477
- body: JSON.stringify(body)
478
- });
479
-
480
- if (!res.ok) {
481
- try {
482
- let errData = await res.json();
483
- return errData
484
- } catch (err) {
485
- // ignore
486
- console.error(err)
487
- }
488
-
489
- throw new Error(`{{_ "Request failed." templateLocale}} status: ${res.status}`);
490
- }
491
-
492
- const data = await res.json();
493
-
494
- return data;
495
- }
358
+ let testSettings = () => eePostConnectionTest(myForm, { requestFailedText: REQUEST_FAILED_TEXT });
496
359
 
497
360
  let runTest = (continueIfSuccessful) => {
498
361
  if (formTesting) {
@@ -577,16 +440,7 @@ focus ring on) the corner close button --}}
577
440
  let imapPortElm = document.getElementById('imap_port');
578
441
  let smtpPortElm = document.getElementById('smtp_port');
579
442
 
580
- try {
581
- if (typeof Intl !== 'undefined' && Intl && typeof Intl.DateTimeFormat === 'function') {
582
- let tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
583
- if (tz) {
584
- document.getElementById('tz').value = tz;
585
- }
586
- }
587
- } catch (err) {
588
- // Intl probably not supported
589
- }
443
+ {{!-- the tz field carries data-ee-tz, which static/js/public.js fills --}}
590
444
 
591
445
  imapPortElm.addEventListener('change', () => checkPort('imap'));
592
446
  imapPortElm.addEventListener('click', () => checkPort('imap'));
@@ -0,0 +1,139 @@
1
+ {{!-- Hosted authentication form, IMAP path: the checking step.
2
+
3
+ Rendered instead of the server settings page when the setup link was issued
4
+ with skipServerSettings and autodiscovery filled in every field the account
5
+ needs (lib/ui-routes/account-routes.js). The page checks the connection and,
6
+ when it holds, submits the same value set the settings form would have
7
+ submitted - so the visitor goes from "email address and password" straight to
8
+ the calling application. A failed check hands them the settings form after all.
9
+
10
+ The form's action is the settings form, the harmless of its two destinations,
11
+ and JavaScript points it at the account-creating endpoint only once the check
12
+ has passed. That way the no-script path and an interrupted check both land on
13
+ the form rather than creating an account nobody verified. --}}
14
+
15
+ <form method="post" id="setup-form" action="/accounts/new/imap/settings">
16
+ <input type="hidden" name="crumb" value="{{crumb}}">
17
+ <input type="hidden" name="data" value="{{values.data}}">
18
+ <input type="hidden" name="sig" value="{{values.sig}}">
19
+ <input type="hidden" name="email" value="{{values.email}}">
20
+ <input type="hidden" name="name" value="{{values.name}}">
21
+ <input type="hidden" name="tz" value="{{values.tz}}" data-ee-tz>
22
+
23
+ {{!-- The connection fields views/accounts/register/imap-server.hbs renders as controls, so both
24
+ pages reach /accounts/new/imap/server with identical payloads and the create endpoint needs no
25
+ branch of its own. The list comes from the same connectionFields schema that validates the
26
+ submission rather than being written out again here, so a field added there travels with it. --}}
27
+ {{#each connectionFieldNames}}
28
+ <input type="hidden" name="{{this}}" value="{{lookup ../values this}}">
29
+ {{/each}}
30
+
31
+ {{!-- Hidden until the script that drives it runs, so a browser without JavaScript is never
32
+ shown a spinner that will never stop. --}}
33
+ <div class="ee-status" id="checking-panel" hidden>
34
+ <span class="ee-icon ee-icon-loader ee-spin ee-status-icon"></span>
35
+ <h1>{{_ "Checking your mail server" templateLocale }}</h1>
36
+ <p class="ee-muted ee-status-servers">{{values.imap_host}} &middot; {{values.smtp_host}}</p>
37
+
38
+ {{!-- Said once the wait stops looking instant, so it does not start to read as a page that
39
+ has stopped working. --}}
40
+ <p class="ee-muted" id="checking-slow" hidden>{{_ "Still checking. This can take up to a minute."
41
+ templateLocale }}</p>
42
+
43
+ {{!-- The way out, offered later than the reassurance. Until the check finishes there is
44
+ nothing else on this page to press, so a visitor whose mail server never answers needs one -
45
+ but leaving early abandons a check the server keeps running to its own timeout, so this waits
46
+ until most of that budget is gone rather than interrupting a check still likely to answer. --}}
47
+ <p id="checking-escape" hidden><button type="submit" class="ee-btn ee-btn-soft ee-btn-sm">{{_
48
+ "Enter server settings manually" templateLocale }}</button></p>
49
+ </div>
50
+
51
+ <div class="ee-status" id="failed-panel" hidden>
52
+ <span class="ee-icon ee-icon-circle-x ee-status-icon ee-error-text"></span>
53
+ <h1>{{_ "We couldn't sign in to your mail server" templateLocale }}</h1>
54
+ <p class="ee-muted">{{_ "Check the settings on the next page and try again." templateLocale }}</p>
55
+
56
+ <dl class="ee-dl ee-status-errors" id="checking-errors"></dl>
57
+
58
+ <div class="ee-form-actions">
59
+ <button type="submit" class="ee-btn ee-btn-primary">
60
+ <span class="ee-icon ee-icon-arrow-right"></span>
61
+ {{_ "Continue to server settings" templateLocale }}
62
+ </button>
63
+ </div>
64
+ </div>
65
+
66
+ <noscript>
67
+ <div class="ee-status">
68
+ <span class="ee-icon ee-icon-mail ee-status-icon"></span>
69
+ <h1>{{_ "Almost there" templateLocale }}</h1>
70
+ <p class="ee-muted">{{_ "Continue to review your mail server settings." templateLocale }}</p>
71
+ <div class="ee-form-actions">
72
+ <button type="submit" class="ee-btn ee-btn-primary">
73
+ <span class="ee-icon ee-icon-arrow-right"></span>
74
+ {{_ "Continue" templateLocale }}
75
+ </button>
76
+ </div>
77
+ </div>
78
+ </noscript>
79
+ </form>
80
+
81
+ <script data-cfasync="false" nonce="{{cspNonce}}">
82
+ // Reveal the spinner before waiting for DOMContentLoaded - the elements above are already
83
+ // parsed, and the panel is what the visitor should see while the rest of the page loads.
84
+ document.getElementById('checking-panel').hidden = false;
85
+
86
+ document.addEventListener('DOMContentLoaded', () => {
87
+
88
+ let myForm = document.getElementById('setup-form');
89
+ let checkingPanelElm = document.getElementById('checking-panel');
90
+ let slowNoticeElm = document.getElementById('checking-slow');
91
+ let escapeElm = document.getElementById('checking-escape');
92
+ let failedPanelElm = document.getElementById('failed-panel');
93
+ let errorsListElm = document.getElementById('checking-errors');
94
+
95
+ {{!-- The create endpoint claims a single-use nonce, so eeSubmitOnce (static/js/public.js)
96
+ guards the submit this page makes for the visitor. No busy button and no constraint
97
+ validation: there is nothing on this page to press or to fill in. --}}
98
+ let submitForm = eeSubmitOnce(myForm);
99
+
100
+ {{!-- Shared with the server settings page, which renders the same rows into a dialog --}}
101
+ {{> public_test_labels}}
102
+
103
+ let showFailure = (data) => {
104
+ eeRenderTestErrors(errorsListElm, data, TEST_ERROR_LABELS);
105
+ // Carried on the action rather than in a field, the same way the success path retargets
106
+ // the form below: it tells the settings form to open by saying why it is being asked for
107
+ myForm.setAttribute('action', '/accounts/new/imap/settings?checkFailed=1');
108
+ checkingPanelElm.hidden = true;
109
+ failedPanelElm.hidden = false;
110
+ };
111
+
112
+ // A mail server that answers slowly is the usual reason this takes a while. The reassurance
113
+ // comes early; the way out comes late, because taking it abandons a check the server keeps
114
+ // running to its own 30 second timeout.
115
+ let waitTimers = [setTimeout(() => (slowNoticeElm.hidden = false), 8 * 1000), setTimeout(() => (escapeElm.hidden = false), 20 * 1000)];
116
+ let clearWaitTimers = () => waitTimers.forEach(timer => clearTimeout(timer));
117
+
118
+ // The server gives up on a connection after 30 seconds, so the timeout only fires when the
119
+ // request itself never comes back. An aborted check is a failed check - the visitor is
120
+ // handed the settings form rather than left on a spinner.
121
+ eePostConnectionTest(myForm, { timeoutMs: 45 * 1000, requestFailedText: REQUEST_FAILED_TEXT })
122
+ .then(data => {
123
+ clearWaitTimers();
124
+ if (data.imap && data.imap.success && data.smtp && data.smtp.success) {
125
+ // Everything checks out, so this form becomes the settings form's submit: same
126
+ // fields, same endpoint, one step less for the visitor.
127
+ // The attribute, not the property: a control named `action` would shadow it
128
+ myForm.setAttribute('action', '/accounts/new/imap/server');
129
+ submitForm();
130
+ return;
131
+ }
132
+ showFailure(data);
133
+ })
134
+ .catch(err => {
135
+ clearWaitTimers();
136
+ showFailure({ error: err });
137
+ });
138
+ })
139
+ </script>