- Add password remember option for smime_passphrase dialog in compose
This commit is contained in:
Hadi Nategh 2017-08-28 16:14:56 +02:00
parent e3799c52fc
commit 4b9b5aa7e4
4 changed files with 17 additions and 2 deletions

View File

@ -1027,7 +1027,7 @@ class Mailer extends Horde_Mime_Mail
{
throw new Exception\WrongUserinput('no certificate found to sign the messase');
}
if (Cache::getSession('mail', 'smime_passphrase')) $params['passphrase'] = Cache::getSession('mail', 'smime_passphrase');
if (!$smime->verifyPassphrase($params['senderPrivKey'], $params['passphrase']))
{
return false;

View File

@ -10,6 +10,10 @@
<hbox>
<passwd id="value" width="80%" blur="enter your passphrase"/>
</hbox>
<hbox>
<textbox id="pass_exp" type="integer" label="Remeber this password for" blur="10" min="1" max="60"/>
<description value="minutes"/>
</hbox>
</hbox>
</vbox>
</template>

View File

@ -2992,6 +2992,14 @@ class mail_compose
try {
if ($_formData['smime_sign'] == 'on')
{
if ($_formData['smime_passphrase'] != '') {
Api\Cache::setSession(
'mail',
'smime_passphrase',
$_formData['smime_passphrase'],
$GLOBALS['egw_info']['user']['preferences']['mail']['smime_pass_exp'] * 60
);
}
$smime_success = $this->_encrypt(
$mail,
$_formData['smime_encrypt'] == 'on'? Mail\Smime::TYPE_SIGN_ENCRYPT: Mail\Smime::TYPE_SIGN,

View File

@ -5734,6 +5734,7 @@ app.classes.mail = AppJS.extend(
smimePassDialog: function (_msg)
{
var self = this;
var pass_exp = egw.preference('smime_pass_exp', 'mail');
et2_createWidget("dialog",
{
callback: function(_button_id, _value)
@ -5744,6 +5745,7 @@ app.classes.mail = AppJS.extend(
pass.set_value(_value.value);
var toolbar = self.et2.getWidgetById('composeToolbar');
toolbar.value = 'send';
egw.set_preference('mail', 'smime_pass_exp', _value.pass_exp);
self.compose_submitAction(false);
}
},
@ -5755,7 +5757,8 @@ app.classes.mail = AppJS.extend(
value:{
content:{
value: '',
message: _msg
message: _msg,
'exp_min': pass_exp
}},
template: egw.webserverUrl+'/api/templates/default/password.xet',
resizable: false