From 2172be0949e44e003cf1d51166764ff791e48e1e Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Thu, 2 Jan 2025 02:52:46 -0800 Subject: boolval is a devious trap it turns out --- inbox_settings.php | 2 +- keys.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/inbox_settings.php b/inbox_settings.php index d7fdc4b..ca806e0 100644 --- a/inbox_settings.php +++ b/inbox_settings.php @@ -238,7 +238,7 @@ class inbox_settings extends rcube_plugin { $this->rcmail->output->command( 'display_message', $this->gettext('keys_imported'), 'notice'); - return isset($_POST['refresh']) ? boolval($_POST['refresh']) : true; + return !isset($_POST['no_refresh']); } function render_import_ui() { diff --git a/keys.js b/keys.js index 0bacf31..7cad8aa 100644 --- a/keys.js +++ b/keys.js @@ -39,14 +39,17 @@ rcube_webmail.prototype.inbox_keys_generate = function() { this.hide_message(generating_message); var lock = this.display_message( this.get_label('inbox_settings.importing_key'), 'loading'); - this.addEventListener('responseafter', () => { + this.addEventListener('responseafter', resp => { + if (resp.response.action != 'plugin.inbox_keys_import') + return; + location.href = 'data:application/pgp-keys;base64,' + btoa(generated.privateKey); this.reload(1500); }); this.http_post( 'plugin.inbox_keys_import', - {import: true, refresh: false, key_data: generated.publicKey, comment}, + {import: true, no_refresh: true, key_data: generated.publicKey, comment}, lock); }); }; -- cgit v1.2.3