mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Must encrypt with the sender key
This commit is contained in:
parent
a34da5de0d
commit
44dfa53cde
7 changed files with 41 additions and 14 deletions
|
|
@ -201,7 +201,19 @@
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.getRecipientsEmails = function ()
|
MessageModel.prototype.getRecipientsEmails = function ()
|
||||||
{
|
{
|
||||||
return _.compact(_.uniq(_.map(this.to.concat(this.cc), function (oItem) {
|
return this.getEmails(['to', 'cc']);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array} aProperties
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
MessageModel.prototype.getEmails = function (aProperties)
|
||||||
|
{
|
||||||
|
var self = this;
|
||||||
|
return _.compact(_.uniq(_.map(_.reduce(aProperties, function (aCarry, sProperty) {
|
||||||
|
return aCarry.concat(self[sProperty]);
|
||||||
|
}, []), function (oItem) {
|
||||||
return oItem ? oItem.email : '';
|
return oItem ? oItem.email : '';
|
||||||
})));
|
})));
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@
|
||||||
bEncrypted = mDom.hasClass('encrypted'),
|
bEncrypted = mDom.hasClass('encrypted'),
|
||||||
bSigned = mDom.hasClass('signed'),
|
bSigned = mDom.hasClass('signed'),
|
||||||
oVerControl = null,
|
oVerControl = null,
|
||||||
aRecipients = oRainLoopMessage ? oRainLoopMessage.getRecipientsEmails() : [],
|
aRecipients = oRainLoopMessage ? oRainLoopMessage.getEmails(['from', 'to', 'cc']) : [],
|
||||||
sData = ''
|
sData = ''
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@
|
||||||
|
|
||||||
&-delete {
|
&-delete {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-names {
|
&-names {
|
||||||
|
|
@ -121,14 +125,14 @@
|
||||||
|
|
||||||
&__name {
|
&__name {
|
||||||
border-bottom: 1px solid transparent;
|
border-bottom: 1px solid transparent;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-bottom: 1px dashed #555;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&__names {
|
&__names {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
|
&:hover .key-list__item__name {
|
||||||
|
border-bottom: 1px dashed #555;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
line-height: 17px;
|
line-height: 17px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
vertical-align: text-top;
|
vertical-align: text-top;
|
||||||
|
|
||||||
|
&.disabled,
|
||||||
|
.disabled & {
|
||||||
|
color: grey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-folder, .icon-folder-add, .icon-list {
|
.icon-folder, .icon-folder-add, .icon-list {
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,7 @@
|
||||||
aKeys.push({
|
aKeys.push({
|
||||||
'empty': !oOption.key,
|
'empty': !oOption.key,
|
||||||
'selected': ko.observable(!!oOption.key),
|
'selected': ko.observable(!!oOption.key),
|
||||||
|
'removable': this.signKey().id !== oOption.key.id,
|
||||||
'users': oOption.key.users,
|
'users': oOption.key.users,
|
||||||
'hash': oOption.key.id.substr(-8).toUpperCase(),
|
'hash': oOption.key.id.substr(-8).toUpperCase(),
|
||||||
'key': oOption.key
|
'key': oOption.key
|
||||||
|
|
@ -372,6 +373,7 @@
|
||||||
if (oIdentity && oIdentity.email())
|
if (oIdentity && oIdentity.email())
|
||||||
{
|
{
|
||||||
sEmail = oIdentity.email();
|
sEmail = oIdentity.email();
|
||||||
|
aRec.unshift(sEmail);
|
||||||
oKey = PgpStore.findPrivateKeyByEmailNotNative(sEmail);
|
oKey = PgpStore.findPrivateKeyByEmailNotNative(sEmail);
|
||||||
if (oKey)
|
if (oKey)
|
||||||
{
|
{
|
||||||
|
|
@ -390,16 +392,19 @@
|
||||||
|
|
||||||
if (aRec && 0 < aRec.length)
|
if (aRec && 0 < aRec.length)
|
||||||
{
|
{
|
||||||
this.encryptKeys(_.compact(_.map(aRec, function (sEmail) {
|
this.encryptKeys(_.uniq(_.compact(_.map(aRec, function (sEmail) {
|
||||||
var oKey = PgpStore.findPublicKeyByEmailNotNative(sEmail) || null;
|
var oKey = PgpStore.findPublicKeyByEmailNotNative(sEmail) || null;
|
||||||
return {
|
return {
|
||||||
'empty': !oKey,
|
'empty': !oKey,
|
||||||
'selected': ko.observable(!!oKey),
|
'selected': ko.observable(!!oKey),
|
||||||
|
'removable': oIdentity && oIdentity.email() && oIdentity.email() !== sEmail,
|
||||||
'users': oKey ? (oKey.users || [sEmail]) : [sEmail],
|
'users': oKey ? (oKey.users || [sEmail]) : [sEmail],
|
||||||
'hash': oKey ? oKey.id.substr(-8).toUpperCase() : '',
|
'hash': oKey ? oKey.id.substr(-8).toUpperCase() : '',
|
||||||
'key': oKey
|
'key': oKey
|
||||||
};
|
};
|
||||||
})));
|
})), function (oEncryptKey) {
|
||||||
|
return oEncryptKey.hash;
|
||||||
|
}));
|
||||||
|
|
||||||
if (0 < this.encryptKeys().length)
|
if (0 < this.encryptKeys().length)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
<div class="key-list-wrp" data-bind="visible: encryptKeys() && encryptKeys().length > 0">
|
<div class="key-list-wrp" data-bind="visible: encryptKeys() && encryptKeys().length > 0">
|
||||||
<div data-bind="foreach: encryptKeys">
|
<div data-bind="foreach: encryptKeys">
|
||||||
<div class="key-list__item row-fluid">
|
<div class="key-list__item row-fluid">
|
||||||
<div class="key-list__item-delete span1" data-bind="click: $parent.deletePublickKey">
|
<div class="key-list__item-delete span1" data-bind="click: removable ? $parent.deletePublickKey : null, css: {'disabled': !removable}">
|
||||||
<i class="icon-trash"></i>
|
<i class="icon-trash"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="key-list__item-hash span3" data-bind="visible: !empty">
|
<div class="key-list__item-hash span3" data-bind="visible: !empty">
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
<input type="password" class="inputPassword input-block-level i18n"
|
<input type="password" class="inputPassword input-block-level i18n"
|
||||||
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||||
data-i18n="[placeholder]POPUPS_COMPOSE_OPEN_PGP/LABEL_PASSWORD"
|
data-i18n="[placeholder]POPUPS_COMPOSE_OPEN_PGP/LABEL_PASSWORD"
|
||||||
data-bind="visible: sign, value: password, hasfocus: password.focus, onEnter: doCommand" />
|
data-bind="visible: sign, textInput: password, hasfocus: password.focus, onEnter: doCommand" />
|
||||||
</div>
|
</div>
|
||||||
<div class="span7" data-bind="visible: encrypt() && 0 < publicKeysOptions().length">
|
<div class="span7" data-bind="visible: encrypt() && 0 < publicKeysOptions().length">
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
|
|
@ -98,7 +98,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn buttonDo" data-bind="command: doCommand, hasfocus: buttonFocus">
|
<button class="btn buttonDo" data-bind="command: doCommand, hasfocus: buttonFocus,
|
||||||
|
enable: (sign() || encrypt()) && (!sign() || (sign() && password().length)) && (!encrypt() || encrypt() && encryptKeys().length > 0)">
|
||||||
<i data-bind="css: {'icon-key': !submitRequest(), 'icon-spinner animated': submitRequest()}"></i>
|
<i data-bind="css: {'icon-key': !submitRequest(), 'icon-spinner animated': submitRequest()}"></i>
|
||||||
|
|
||||||
<span class="i18n" data-bind="visible: sign() && !encrypt()" data-i18n="POPUPS_COMPOSE_OPEN_PGP/BUTTON_SIGN"></span>
|
<span class="i18n" data-bind="visible: sign() && !encrypt()" data-i18n="POPUPS_COMPOSE_OPEN_PGP/BUTTON_SIGN"></span>
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,13 @@
|
||||||
<label class="i18n control-label" data-i18n="POPUPS_MESSAGE_OPEN_PGP/LABEL_PASSWORD"></label>
|
<label class="i18n control-label" data-i18n="POPUPS_MESSAGE_OPEN_PGP/LABEL_PASSWORD"></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="password" class="inputPassword input-xlarge" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
<input type="password" class="inputPassword input-xlarge" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||||
data-bind="value: password, hasfocus: password.focus, onEnter: doCommand" />
|
data-bind="textInput: password, hasfocus: password.focus, onEnter: doCommand" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn buttonDo" data-bind="command: doCommand, hasfocus: buttonFocus">
|
<button class="btn buttonDo" data-bind="command: doCommand, hasfocus: buttonFocus, enable: password().length > 0">
|
||||||
<i data-bind="css: {'icon-key': !submitRequest(), 'icon-spinner animated': submitRequest()}"></i>
|
<i data-bind="css: {'icon-key': !submitRequest(), 'icon-spinner animated': submitRequest()}"></i>
|
||||||
|
|
||||||
<span class="i18n" data-i18n="POPUPS_MESSAGE_OPEN_PGP/BUTTON_DECRYPT"></span>
|
<span class="i18n" data-i18n="POPUPS_MESSAGE_OPEN_PGP/BUTTON_DECRYPT"></span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue