From 61c9acce842794ad712811e5b91fc3d02732d283 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 10 Jul 2017 12:57:14 +0200 Subject: [PATCH] Smime W.I.P: - Fix smime passphrase dialog --- mail/inc/class.mail_compose.inc.php | 10 +++++++--- mail/js/app.js | 18 +++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 2f17db840d..2467bc0d88 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -2996,7 +2996,10 @@ class mail_compose if (!$smime_success) { $response = Api\Json\Response::get(); - $response->call('app.mail.smimePassDialog'); + $this->errorInfo = $_formData['smime_passphrase'] == ''? + lang('You need to enter your S/MIME passphrase to send this message.'): + lang('The entered passphrase is not correct! Please try again.'); + $response->call('app.mail.smimePassDialog', $this->errorInfo); return false; } } @@ -3627,11 +3630,12 @@ class mail_compose /** * Method to do encryption on given mail object * - * @param Horde_MIME_Mail $mail + * @param Api\Mailer $mail * @param string $type encryption type * @param array|string $recipients list of recipients * @param string $sender email of sender - * + * @param string $passphrase = '', SMIME Private key passphrase + * * @return boolean returns true if successful and false if passphrase required * @throws Api\Exception\WrongUserinput if no certificate found */ diff --git a/mail/js/app.js b/mail/js/app.js index 4a9b521aae..647c1e7e5d 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -5699,26 +5699,34 @@ app.classes.mail = AppJS.extend( /** * smime password dialog - */ - smimePassDialog: function () + * + * @param {string} _msg message + */ + smimePassDialog: function (_msg) { var self = this; et2_createWidget("dialog", { callback: function(_button_id, _value) { - if (_button_id && _value) + if (_button_id == 'send' && _value) { var pass = self.et2.getWidgetById('smime_passphrase'); pass.set_value(_value.value); + var toolbar = self.et2.getWidgetById('composeToolbar'); + toolbar.value = 'send'; + self.compose_submitAction(false); } }, title: egw.lang('Request for passphrase'), - buttons: et2_dialog.BUTTONS_OK_CANCEL, + buttons: [ + {text: this.egw.lang("Send"), id: "send", "class": "ui-priority-primary", "default": true}, + {text: this.egw.lang("Cancel"), id:"cancel"} + ], value:{ content:{ value: '', - message: self.egw.lang('Looks like your certificate is password protected. Please enter your passphrase and try to send again.') + message: _msg }}, template: egw.webserverUrl+'/api/templates/default/password.xet', resizable: false