From 2efe90fe48f871c059ce693ec90d925b2ab3b3f8 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Fri, 1 Mar 2024 02:08:29 +0100 Subject: [PATCH] https://github.com/the-djmaze/snappymail/issues/1450#issuecomment-1972147950 --- dev/Model/Identity.js | 6 +++--- dev/View/Popup/Compose.js | 2 +- .../v/0.0.0/app/templates/Views/User/PopupsIdentity.html | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/Model/Identity.js b/dev/Model/Identity.js index ac46a15fe..89beda875 100644 --- a/dev/Model/Identity.js +++ b/dev/Model/Identity.js @@ -32,9 +32,9 @@ export class IdentityModel extends AbstractModel { }); addComputablesTo(this, { - smimeKeyEncrypted: () => this.smimeKey().includes('-----BEGIN ENCRYPTED PRIVATE KEY-----') -// smimeKeyValid: () => this.smimeKeyEncrypted() | this.smimeKey().includes('-----BEGIN PRIVATE KEY-----') -// smimeCertificateValid: () => this.smimeKey().includes('-----BEGIN CERTIFICATE-----') + smimeKeyEncrypted: () => this.smimeKey().includes('-----BEGIN ENCRYPTED PRIVATE KEY-----'), + smimeKeyValid: () => /^-----BEGIN (ENCRYPTED )?PRIVATE KEY-----/.test(this.smimeKey()), + smimeCertificateValid: () => /^-----BEGIN CERTIFICATE-----/.test(this.smimeCertificate()) }); } diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 2fd0e23bd..4384c5b25 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -1377,7 +1377,7 @@ export class ComposePopupView extends AbstractViewPopup { key && options.push(['OpenPGP', key]); key = GnuPGUserStore.getPrivateKeyFor(email, 1); key && options.push(['GnuPG', key]); - identity.smimeKey() && identity.smimeCertificate() && identity.email() === email + identity.smimeKeyValid() && identity.smimeCertificateValid() && identity.email() === email && options.push(['S/MIME']); console.dir({signOptions: options}); this.signOptions(options); diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html index 57c451116..2f7934fdc 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html @@ -88,11 +88,11 @@ -->
S/MIME -
+
-
+