- Implement unknownemail status in case signer email address is not matched with sender email address
This commit is contained in:
Hadi Nategh 2017-08-25 16:07:09 +02:00
parent 38b844c91f
commit 36211267bf
5 changed files with 58 additions and 23 deletions

View File

@ -7381,15 +7381,26 @@ class Mail
if ($cert) // signed message, it might be encrypted too if ($cert) // signed message, it might be encrypted too
{ {
$envelope = $this->getMessageEnvelope($params['uid'], '', false, $params['mailbox']);
$from = $this->stripRFC822Addresses($envelope['FROM']);
$message_parts = $this->smime->extractSignedContents($message); $message_parts = $this->smime->extractSignedContents($message);
//$f = $message_parts->_headers->getHeader('from');
$metadata = array_merge ($metadata, array ( $metadata = array_merge ($metadata, array (
'verify' => $cert->verify, 'verify' => $cert->verify,
'cert' => $cert->cert, 'cert' => $cert->cert,
'msg' => $cert->msg, 'msg' => $cert->msg,
'certHtml' => $this->smime->certToHTML($cert->cert), 'certHtml' => $this->smime->certToHTML($cert->cert),
'email' => $cert->email, 'email' => $cert->email,
'signed' => true, 'signed' => true
)); ));
// check for email address if both signer email address and
// email address of sender are the same.
if (is_array($from) && $from[0] != $cert->email)
{
$metadata['unknownemail'] = true;
$metadata['msg'] .= ' '.lang('Email address of signer is different from the email address of sender!');
}
$AB_bo = new \addressbook_bo(); $AB_bo = new \addressbook_bo();
$certkey = $AB_bo->get_smime_keys($cert->email); $certkey = $AB_bo->get_smime_keys($cert->email);
if (!is_array($certkey) || $certkey[$cert->email] != $cert->cert) $metadata['addtocontact'] = true; if (!is_array($certkey) || $certkey[$cert->email] != $cert->cert) $metadata['addtocontact'] = true;

View File

@ -5837,21 +5837,26 @@ app.classes.mail = AppJS.extend(
else if (data.verify) else if (data.verify)
{ {
$mail_container.addClass((data.class='smime_cert_verified')); $mail_container.addClass((data.class='smime_cert_verified'));
smime_signature.set_class('smime_cert_verified'); smime_signature.set_class(data.class);
smime_signature.set_statustext(data.msg); smime_signature.set_statustext(data.msg);
} }
else if (!data.verify && data.cert) else if (!data.verify && data.cert)
{ {
$mail_container.addClass((data.class='smime_cert_notverified')); $mail_container.addClass((data.class='smime_cert_notverified'));
smime_signature.set_class('smime_cert_notverified'); smime_signature.set_class(data.class);
smime_signature.set_statustext(data.msg); smime_signature.set_statustext(data.msg);
} }
else if (!data.verify && !data.cert) else if (!data.verify && !data.cert)
{ {
$mail_container.addClass((data.class='smime_cert_notvalid')); $mail_container.addClass((data.class='smime_cert_notvalid'));
smime_signature.set_class('smime_cert_notvalid'); smime_signature.set_class(data.class);
smime_signature.set_statustext(data.msg); smime_signature.set_statustext(data.msg);
} }
if (data.unknownemail)
{
$mail_container.addClass((data.class='smime_cert_unknownemail'));
smime_signature.set_class(data.class);
}
jQuery(smime_signature.getDOMNode(), smime_encryption.getDOMNode()).on('click',function(){ jQuery(smime_signature.getDOMNode(), smime_encryption.getDOMNode()).on('click',function(){
self.smime_certAddToContact(data,true); self.smime_certAddToContact(data,true);
}); });
@ -5869,7 +5874,7 @@ app.classes.mail = AppJS.extend(
{ {
for(var i=0;i<_nodes.length;i++) for(var i=0;i<_nodes.length;i++)
{ {
var smime_classes = 'smime_cert_verified smime_cert_notverified smime_cert_notvalid'; var smime_classes = 'smime_cert_verified smime_cert_notverified smime_cert_notvalid smime_cert_unknownemail';
_nodes[i].removeClass(smime_classes); _nodes[i].removeClass(smime_classes);
_nodes[i].off('click'); _nodes[i].off('click');
} }

View File

@ -914,20 +914,27 @@ div.mailComposeHeaderSection>table {
.header_row_right.vertical_splitter div#mail-index_mail-index-vacationnotice .et2_vbox {margin-right: 0;} .header_row_right.vertical_splitter div#mail-index_mail-index-vacationnotice .et2_vbox {margin-right: 0;}
div.smime_cert_notverified { div.smime_cert_notverified {
border-top: 4px solid lightgreen !important; border-top: 4px solid #8dff95 !important;
} }
img.smime_cert_notverified { img.smime_cert_notverified {
background: lightgreen; background: #8dff95;
} }
div.smime_cert_verified { div.smime_cert_verified {
border-top: 4px solid green !important; border-top: 4px solid #1ab82c !important;
} }
div.smime_cert_unknownemail {
border-top: 4px solid #a28cff !important;
}
img.smime_cert_verified { img.smime_cert_verified {
background: green; background: #1ab82c;
} }
div.smime_cert_notvalid { div.smime_cert_notvalid {
border-top: 4px solid red !important; border-top: 4px solid #e90052 !important;
} }
img.smime_cert_notvalid { img.smime_cert_notvalid {
background: red; background: #e90052;
}
img.smime_cert_unknownemail {
background: #a28cff;
} }

View File

@ -902,22 +902,28 @@ div.mailComposeHeaderSection > table {
margin-right: 0; margin-right: 0;
} }
div.smime_cert_notverified { div.smime_cert_notverified {
border-top: 4px solid lightgreen !important; border-top: 4px solid #8dff95 !important;
} }
img.smime_cert_notverified { img.smime_cert_notverified {
background: lightgreen; background: #8dff95;
} }
div.smime_cert_verified { div.smime_cert_verified {
border-top: 4px solid green !important; border-top: 4px solid #1ab82c !important;
}
div.smime_cert_unknownemail {
border-top: 4px solid #a28cff !important;
} }
img.smime_cert_verified { img.smime_cert_verified {
background: green; background: #1ab82c;
} }
div.smime_cert_notvalid { div.smime_cert_notvalid {
border-top: 4px solid red !important; border-top: 4px solid #e90052 !important;
} }
img.smime_cert_notvalid { img.smime_cert_notvalid {
background: red; background: #e90052;
}
img.smime_cert_unknownemail {
background: #a28cff;
} }
#popupMainDiv { #popupMainDiv {
padding: 5px; padding: 5px;

View File

@ -890,22 +890,28 @@ div.mailComposeHeaderSection > table {
margin-right: 0; margin-right: 0;
} }
div.smime_cert_notverified { div.smime_cert_notverified {
border-top: 4px solid lightgreen !important; border-top: 4px solid #8dff95 !important;
} }
img.smime_cert_notverified { img.smime_cert_notverified {
background: lightgreen; background: #8dff95;
} }
div.smime_cert_verified { div.smime_cert_verified {
border-top: 4px solid green !important; border-top: 4px solid #1ab82c !important;
}
div.smime_cert_unknownemail {
border-top: 4px solid #a28cff !important;
} }
img.smime_cert_verified { img.smime_cert_verified {
background: green; background: #1ab82c;
} }
div.smime_cert_notvalid { div.smime_cert_notvalid {
border-top: 4px solid red !important; border-top: 4px solid #e90052 !important;
} }
img.smime_cert_notvalid { img.smime_cert_notvalid {
background: red; background: #e90052;
}
img.smime_cert_unknownemail {
background: #a28cff;
} }
#popupMainDiv { #popupMainDiv {
padding: 5px; padding: 5px;