diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 99b7a67df2..f0935290c4 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -125,7 +125,10 @@ public function index(): TemplateResponse { 'debug', $this->config->getSystemValue('debug', false) ); - + $this->initialStateService->provideInitialState( + 'smime-sign-accounts', + $this->preferences->getPreference($this->currentUserId, 'smime-sign-accounts','') + ); $this->initialStateService->provideInitialState( 'ncVersion', $this->config->getSystemValue('version', '0.0.0') @@ -183,6 +186,7 @@ public function index(): TemplateResponse { 'collect-data' => $this->preferences->getPreference($this->currentUserId, 'collect-data', 'true'), 'start-mailbox-id' => $this->preferences->getPreference($this->currentUserId, 'start-mailbox-id'), 'tag-classified-messages' => $this->preferences->getPreference($this->currentUserId, 'tag-classified-messages', 'true'), + ]); $this->initialStateService->provideInitialState( 'prefill_displayName', diff --git a/src/components/Composer.vue b/src/components/Composer.vue index e7bbd628de..ab3e2d54bc 100644 --- a/src/components/Composer.vue +++ b/src/components/Composer.vue @@ -309,8 +309,7 @@ + @change="setSmimeSign($event)"> {{ t('mail', 'Sign message with S/MIME') }} account !== '') + }, + /** + * whether the user set a sign preference for the current account/alias + */ + isSignSet() { + return this.accountWithSmimeSignSet.includes(this.selectedAlias.emailAddress) + }, /** * Whether the outgoing message should be signed with S/MIME. * @@ -898,6 +905,29 @@ export default { window.removeEventListener('mailvelope', this.onMailvelopeLoaded) }, methods: { + setSmimeSign(e) { + console.log(e) + this.wantsSmimeSign = e.target.checked + let value + if (e.target.checked) { + value = [...this.accountWithSmimeSignSet, this.selectedAlias.emailAddress] + } else { + value = this.accountWithSmimeSignSet.filter((email) => email !== this.selectedAlias.emailAddress) + } + console.log(e, value) + this.$store + .dispatch('savePreference', { + key: 'smime-sign-accounts', + value: value.toString(), + }) + .then(() => { + showWarning(t('mail', value)) + }) + .catch((error) => Logger.error('could not save preferences', { error })) + .then((error) => { + showWarning(t('mail', error)) + }) + }, openPicker() { this.isPickerOpen = true },