Smime W.I.P:

- Fix smime passphrase dialog
This commit is contained in:
Hadi Nategh 2017-07-10 12:57:14 +02:00
parent afe1459387
commit 61c9acce84
2 changed files with 20 additions and 8 deletions

View File

@ -2996,7 +2996,10 @@ class mail_compose
if (!$smime_success) if (!$smime_success)
{ {
$response = Api\Json\Response::get(); $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; return false;
} }
} }
@ -3627,10 +3630,11 @@ class mail_compose
/** /**
* Method to do encryption on given mail object * Method to do encryption on given mail object
* *
* @param Horde_MIME_Mail $mail * @param Api\Mailer $mail
* @param string $type encryption type * @param string $type encryption type
* @param array|string $recipients list of recipients * @param array|string $recipients list of recipients
* @param string $sender email of sender * @param string $sender email of sender
* @param string $passphrase = '', SMIME Private key passphrase
* *
* @return boolean returns true if successful and false if passphrase required * @return boolean returns true if successful and false if passphrase required
* @throws Api\Exception\WrongUserinput if no certificate found * @throws Api\Exception\WrongUserinput if no certificate found

View File

@ -5699,26 +5699,34 @@ app.classes.mail = AppJS.extend(
/** /**
* smime password dialog * smime password dialog
*
* @param {string} _msg message
*/ */
smimePassDialog: function () smimePassDialog: function (_msg)
{ {
var self = this; var self = this;
et2_createWidget("dialog", et2_createWidget("dialog",
{ {
callback: function(_button_id, _value) callback: function(_button_id, _value)
{ {
if (_button_id && _value) if (_button_id == 'send' && _value)
{ {
var pass = self.et2.getWidgetById('smime_passphrase'); var pass = self.et2.getWidgetById('smime_passphrase');
pass.set_value(_value.value); pass.set_value(_value.value);
var toolbar = self.et2.getWidgetById('composeToolbar');
toolbar.value = 'send';
self.compose_submitAction(false);
} }
}, },
title: egw.lang('Request for passphrase'), 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:{ value:{
content:{ content:{
value: '', 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', template: egw.webserverUrl+'/api/templates/default/password.xet',
resizable: false resizable: false