From ecefdca21dba3bce4dc597a48bf93b67931f6c94 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 23 Oct 2016 15:51:28 +0200 Subject: [PATCH] GnuPG 2.1: Support password input on private key export --- plugins/enigma/enigma.js | 30 ++++++++++--- plugins/enigma/enigma.php | 2 + plugins/enigma/lib/enigma_driver.php | 3 +- plugins/enigma/lib/enigma_driver_gnupg.php | 8 +++- plugins/enigma/lib/enigma_driver_phpssl.php | 2 +- plugins/enigma/lib/enigma_engine.php | 2 +- plugins/enigma/lib/enigma_ui.php | 48 ++++++++++++++++----- 7 files changed, 74 insertions(+), 21 deletions(-) diff --git a/plugins/enigma/enigma.js b/plugins/enigma/enigma.js index 3dc3e9a89..f5ae0e4ac 100644 --- a/plugins/enigma/enigma.js +++ b/plugins/enigma/enigma.js @@ -167,12 +167,12 @@ rcube_webmail.prototype.enigma_export = function(selected) var priv = false, list = this.keys_list, keys = selected ? list.get_selection().join(',') : '*', - args = {_a: 'export', _keys: keys}; + args = {_keys: keys}; if (!keys.length) return; - // find out wether selected keys are private + // find out whether selected keys are private if (keys == '*') priv = true; else @@ -192,7 +192,7 @@ rcube_webmail.prototype.enigma_export = function(selected) [{ text: this.get_label('enigma.onlypubkeys'), click: function(e) { - rcmail.goto_url('plugin.enigmakeys', args, false, true); + rcmail.enigma_export_submit(args); $(this).remove(); } }, @@ -200,14 +200,32 @@ rcube_webmail.prototype.enigma_export = function(selected) text: this.get_label('enigma.withprivkeys'), click: function(e) { args._priv = 1; - rcmail.goto_url('plugin.enigmakeys', args, false, true); + rcmail.enigma_export_submit(args); $(this).remove(); } }], {width: 400} ); - this.goto_url('plugin.enigmakeys', args, false, true); + this.enigma_export_submit(args); +}; + +// Sumbitting request for key(s) export +// Done this way to handle password input +rcube_webmail.prototype.enigma_export_submit = function(data) +{ + var id = 'keyexport-' + new Date().getTime(), + form = $('
').attr({target: id, method: 'post', style: 'display:none', + action: '?_action=plugin.enigmakeys&_task=settings&_a=export'}), + iframe = $('