1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-28 03:42:16 -05:00

implement recipient key validation while typing

This commit is contained in:
Tankred Hase 2013-11-04 21:07:32 +01:00
parent e23236a7dc
commit 0cefc08fa3
12 changed files with 98 additions and 46 deletions

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Styleguide for Whiteout Mail Client</title> <title>Styleguide for Whiteout Mail Client</title>
<link rel="stylesheet" href="../dist/css/all.css"> <link rel="stylesheet" href="../dist/css/all.min.css">
<style> <style>
body { body {

Binary file not shown.

View File

@ -1,40 +1,20 @@
<?xml version="1.0" standalone="no"?> <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg">
<metadata> <metadata>Generated by IcoMoon</metadata>
This is a custom SVG font generated by IcoMoon.
<iconset grid="16"></iconset>
</metadata>
<defs> <defs>
<font id="icomoon" horiz-adv-x="512" > <font id="icomoon" horiz-adv-x="1024">
<font-face units-per-em="512" ascent="480" descent="-32" /> <font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="512" /> <missing-glyph horiz-adv-x="1024" />
<glyph class="hidden" unicode="&#xf000;" d="M0,480L 512 -32L0 -32 z" horiz-adv-x="0" /> <glyph unicode="&#x20;" d="" horiz-adv-x="0" />
<glyph unicode="&#xe000;" d="M 256,480C 114.977,480,0,365.023,0,224s 114.977-256, 256-256c 141.023,0, 256,114.977, 256,256S 397.023,480, 256,480z M 310.227,224l 108.477-108.477 <glyph unicode="&#xe000;" d="M512 960c-282.046 0-512-229.954-512-512s229.954-512 512-512c282.046 0 512 229.954 512 512s-229.954 512-512 512zM620.454 448l216.954-216.954-108.454-108.454-216.954 216.954-216.954-216.954-108.454 108.454 216.954 216.954-216.954 216.954 108.454 108.454 216.954-216.954 216.954 216.954 108.454-108.454-216.954-216.954z" />
l-54.227-54.227l-108.477,108.477l-108.477-108.477l-54.227,54.227l 108.477,108.477l-108.477,108.477l 54.227,54.227l 108.477-108.477l 108.477,108.477l 54.227-54.227L 310.227,224z" /> <glyph unicode="&#xe001;" d="M923.090 828.37h426.728v-125.254h-426.728zM1076.13 976.802h125.254v-426.728h-125.254zM848.85-39.052c-4.654-32.488 0-32.488-46.406-37.096-27.834-4.654-194.84-4.654-366.452-4.654-194.84 0-398.894 0-412.812 4.654-55.668 13.918-23.18 120.6 51.014 171.614 60.322 37.096 180.922 97.42 213.364 102.028 46.406 9.262 51.014 37.096 0 125.254-9.262 18.572-23.18 78.848-23.18 143.778 0 102.028 18.572 171.614 106.682 208.756 18.572 4.654 37.096 9.262 55.668 9.262 60.322 0 115.944-32.488 139.17-83.502 32.488-64.93 18.572-236.544-18.572-296.866-41.752-69.586-37.096-92.766 9.262-102.028 27.834-9.262 120.6-51.014 208.756-97.42 60.326-32.442 92.768-88.112 83.506-143.78zM1136.454 81.548c0-23.18 0-27.834-32.488-32.488-18.572-4.654-102.028-4.654-208.756-4.654-18.572 41.752-51.014 83.502-102.028 106.682-55.668 32.488-115.944 60.322-167.006 83.502 32.488 13.918 60.322 27.834 74.24 32.488 32.488 9.262 37.096 27.834 0 97.42-9.262 18.572-18.572 64.93-23.18 115.944 0 78.848 18.572 134.516 88.11 162.35 13.918 4.654 27.834 4.654 41.752 4.654 46.406 0 88.11-23.18 106.682-64.93 23.18-51.014 13.918-185.53-13.918-236.544-32.488-55.668-27.834-74.24 9.262-78.848 23.18-4.654 92.766-41.752 162.35-78.848 41.8-23.226 69.588-64.978 64.98-106.728z" horiz-adv-x="1348" />
<glyph unicode="&#xe001;" d="M 461.545,414.185L 674.909,414.185L 674.909,351.558L 461.545,351.558zM 538.065,488.401L 600.692,488.401L 600.692,275.037L 538.065,275.037zM 424.425-19.526c-2.327-16.244,0-16.244-23.203-18.548c-13.917-2.327-97.42-2.327-183.226-2.327c-97.42,0-199.447,0-206.406,2.327c-27.834,6.959-11.59,60.3, 25.507,85.807 <glyph unicode="&#xe002;" d="M0 551.488l458.048 420.416v-213.312c884.736 0 821.952-840.768 821.952-840.768-175.68 583.552-821.952 414.144-821.952 414.144v-213.312l-458.048 432.832z" horiz-adv-x="1280" />
c 30.161,18.548, 90.461,48.71, 106.682,51.014c 23.203,4.631, 25.507,18.548,0,62.627c-4.631,9.286-11.59,39.424-11.59,71.889c0,51.014, 9.286,85.807, 53.341,104.378c 9.286,2.327, 18.548,4.631, 27.834,4.631 <glyph unicode="&#xe003;" d="M677.79 796.648c4.876 4.876 39.010 39.010 97.524 58.514 78.020 24.38 160.914 4.876 224.304-58.514 63.39-63.39 87.772-141.41 58.514-224.304-19.504-58.514-53.638-97.524-58.514-102.4l-448.61-448.61c-78.020-78.020-273.066-180.42-453.486 0-180.42 180.42-78.020 375.466 0 448.61l482.742 482.742c19.504 19.504 48.762 19.504 63.39 0 19.504-19.504 19.504-48.762 0-63.39l-482.742-482.742c-9.752-4.876-160.914-160.914 0-321.828 156.038-156.038 307.2-14.628 321.828 0l448.61 453.486c0 0 24.38 24.38 39.010 63.39 14.628 48.762 4.876 87.772-39.010 131.658-87.772 87.772-175.542 14.628-195.048 0l-419.352-419.352c-14.628-14.628-24.38-39.010 0-68.266 24.38-24.38 48.762-14.628 63.39 0l292.572 292.572c19.504 14.628 48.762 14.628 63.39 0 19.504-19.504 19.504-48.762 0-68.266l-292.572-287.696c-39.010-39.010-121.904-68.266-195.048 0-73.142 68.266-39.010 156.038 0 195.048l429.108 419.348z" horiz-adv-x="1072" />
c 30.161,0, 57.972-16.244, 69.585-41.751c 16.244-32.465, 9.286-118.272-9.286-148.433c-20.876-34.793-18.548-46.383, 4.631-51.014c 13.917-4.631, 60.3-25.507, 104.378-48.71C 412.835,36.143, 429.056,8.308, 424.425-19.526z <glyph unicode="&#xe004;" d="M0 951.326h1445.648v-193.114h-1445.648zM0 137.788h1445.648v-193.174h-1445.648zM0 547.508h1445.648v-193.174h-1445.648z" horiz-adv-x="1444" />
M 568.227,40.774c0-11.59,0-13.917-16.244-16.244c-9.286-2.327-51.014-2.327-104.378-2.327c-9.286,20.876-25.507,41.751-51.014,53.341c-27.834,16.244-57.972,30.161-83.503,41.751 <glyph unicode="&#xe005;" d="M764.712 818.958c26.138 0 46.996-20.912 46.996-46.996v-31.366c0-20.912-15.684-41.822-36.594-46.996v-679.182c0-41.822-36.594-78.362-83.59-78.362l-574.626-0.056c-46.996 0-83.59 36.594-83.59 78.362v679.182c-20.912 5.228-36.596 26.14-36.596 47.050v31.314c0 26.138 20.912 46.996 46.996 46.996h141.042l0.056 57.506c0 46.996 36.54 83.59 78.362 83.59h276.912c46.996 0 83.59-36.594 83.59-83.59v-57.452h141.042zM670.666 30.046c5.228 0 10.456 5.228 10.456 10.456v653.042h-553.822v-653.042c0-5.228 5.228-10.456 10.456-10.456h532.91zM237.030 82.27c-26.138 0-46.996 20.912-46.996 46.996l-0.002 465.004c0 26.138 20.912 41.822 46.996 41.822h10.456c26.138 0 46.996-20.912 46.996-41.822v-465.004c0-26.138-20.912-46.996-46.996-46.996h-10.454zM263.168 886.864c-5.228 0-10.456 0-10.456-10.454v-57.452h302.996v57.452c0 5.228-5.228 10.456-10.456 10.456l-282.084-0.002zM398.982 82.27c-26.138 0-46.996 20.912-46.996 46.996v465.004c0 26.138 20.912 41.822 46.996 41.822h5.228c26.138 0 46.996-20.912 46.996-41.822v-465.004c0-26.138-20.912-46.996-46.996-46.996h-5.228zM560.936 82.27c-26.138 0-46.996 20.912-46.996 46.996v465.004c0 26.138 20.912 41.822 46.996 41.822h10.456c26.138 0 46.996-20.912 46.996-41.822v-465.004c0-26.138-20.912-46.996-46.996-46.996h-10.456z" horiz-adv-x="808" />
c 16.244,6.959, 30.161,13.917, 37.12,16.244c 16.244,4.631, 18.548,13.917,0,48.71c-4.631,9.286-9.286,32.465-11.59,57.972c0,39.424, 9.286,67.258, 44.055,81.175c 6.959,2.327, 13.917,2.327, 20.876,2.327 <glyph unicode="&#xe006;" d="M876.828 327.396l126.066 126.066v-372.622c0-76.744-60.302-136.988-131.528-136.988l-739.838-0.058c-76.744 0-131.528 60.302-131.528 136.988v734.378c0 76.688 60.302 136.99 131.528 136.99h750.762l-126.066-126.066h-580.836c-27.42 0-49.322-21.902-49.322-49.322v-652.118c0-27.42 21.902-49.322 49.322-49.322h652.118c27.42 0 49.322 21.902 49.322 49.322v202.752zM613.774 239.73l-131.528 131.528-49.322-180.85 180.85 49.322zM657.636 283.592l427.464 427.464-131.586 131.468-427.406-421.944 131.528-136.988zM1134.364 754.858l60.302 60.302-136.988 136.99-60.302-60.302 136.988-136.99z" horiz-adv-x="1194" />
c 23.203,0, 44.055-11.59, 53.341-32.465c 11.59-25.507, 6.959-92.765-6.959-118.272c-16.244-27.834-13.917-37.12, 4.631-39.424c 11.59-2.327, 46.383-20.876, 81.175-39.424C 556.637,82.525, 570.531,61.649, 568.227,40.774z" horiz-adv-x="674.909" /> <glyph unicode="&#xe007;" d="M117.76 954.88l906.176-906.112-121.408-121.408-906.176 906.112zM-3.648 57.536l906.112 906.112 121.408-121.344-906.112-906.176z" />
<glyph unicode="&#xe002;" d="M0,275.744L 229.024,485.952l0-106.656 c 442.368,0, 410.976-420.384, 410.976-420.384c-87.84,291.776-410.976,207.072-410.976,207.072l0-106.656 L0,275.744z" horiz-adv-x="640" /> <glyph unicode="&#xe008;" d="M0 960l1024-1024h-1024z" />
<glyph unicode="&#xe003;" d="M 338.895,398.324c 2.438,2.438, 19.505,19.505, 48.762,29.257c 39.010,12.19, 80.457,2.438, 112.152-29.257c 31.695-31.695, 43.886-70.705, 29.257-112.152c-9.752-29.257-26.819-48.762-29.257-51.2 <glyph unicode="&#xe009;" d="M681.984 655.104v-119.744h-153.6v119.744c0 81.472-64.768 147.712-144.384 147.712s-144.384-66.24-144.384-147.712v-119.744h-153.6v119.744c-0.064 168.064 133.696 304.896 297.984 304.896 164.352 0 297.984-136.832 297.984-304.896zM0 476.096v-540.096h768v540.096h-768zM308.224-0.896l24.192 195.968 5.12 41.792c-21.632 15.232-35.712 40.64-35.712 69.44 0 11.136 2.112 21.696 5.888 31.296 12.096 30.848 41.664 52.736 76.288 52.736 34.624 0 64.192-21.888 76.288-52.736 3.776-9.664 5.888-20.224 5.888-31.296 0-28.8-14.208-54.272-35.84-69.312l5.184-41.856 24.064-195.968h-151.36z" horiz-adv-x="768" />
l-224.305-224.305c-39.010-39.010-136.533-90.21-226.743,0c-90.21,90.21-39.010,187.733,0,224.305l 241.371,241.371c 9.752,9.752, 24.381,9.752, 31.695,0c 9.752-9.752, 9.752-24.381,0-31.695l-241.371-241.371
c-4.876-2.438-80.457-80.457,0-160.914c 78.019-78.019, 153.6-7.314, 160.914,0l 224.305,226.743c0,0, 12.19,12.19, 19.505,31.695c 7.314,24.381, 2.438,43.886-19.505,65.829c-43.886,43.886-87.771,7.314-97.524,0l-209.676-209.676
c-7.314-7.314-12.19-19.505,0-34.133c 12.19-12.19, 24.381-7.314, 31.695,0l 146.286,146.286c 9.752,7.314, 24.381,7.314, 31.695,0c 9.752-9.752, 9.752-24.381,0-34.133l-146.286-143.848c-19.505-19.505-60.952-34.133-97.524,0
c-36.571,34.133-19.505,78.019,0,97.524L 338.895,398.324z" horiz-adv-x="536.381" />
<glyph unicode="&#xe004;" d="M0,475.663L 722.824,475.663L 722.824,379.106L0,379.106zM0,68.894L 722.824,68.894L 722.824-27.693L0-27.693zM0,273.754L 722.824,273.754L 722.824,177.167L0,177.167z" horiz-adv-x="722.824" />
<glyph unicode="&#xe005;" d="M 382.356,409.479c 13.069,0, 23.498-10.456, 23.498-23.498l0-15.683 c0-10.456-7.842-20.911-18.297-23.498l0-339.591 c0-20.911-18.297-39.181-41.795-39.181L 58.449-32
c-23.498,0-41.795,18.297-41.795,39.181l0,339.591 C 6.198,349.386,-1.644,359.842,-1.644,370.297L-1.644,385.954 c0,13.069, 10.456,23.498, 23.498,23.498l 70.521,0 L 92.403,438.205 C 92.403,461.703, 110.673,480, 131.584,480l 138.456,0 C 293.538,480, 311.835,461.703, 311.835,438.205
l0-28.726 L 382.356,409.479L 382.356,409.479z M 335.333,15.023c 2.614,0, 5.228,2.614, 5.228,5.228L 340.561,346.772 L 63.65,346.772 l0-326.521 c0-2.614, 2.614-5.228, 5.228-5.228L 335.333,15.023 z M 118.515,41.135
c-13.069,0-23.498,10.456-23.498,23.498L 95.016,297.135 c0,13.069, 10.456,20.911, 23.498,20.911l 5.228,0 c 13.069,0, 23.498-10.456, 23.498-20.911l0-232.502 c0-13.069-10.456-23.498-23.498-23.498L 118.515,41.135 z M 131.584,443.432
C 128.97,443.432, 126.356,443.432, 126.356,438.205l0-28.726 l 151.498,0 L 277.854,438.205 c0,2.614-2.614,5.228-5.228,5.228L 131.584,443.432 z M 199.491,41.135c-13.069,0-23.498,10.456-23.498,23.498L 175.993,297.135 c0,13.069, 10.456,20.911, 23.498,20.911l 2.614,0
c 13.069,0, 23.498-10.456, 23.498-20.911l0-232.502 c0-13.069-10.456-23.498-23.498-23.498L 199.491,41.135 z M 280.468,41.135c-13.069,0-23.498,10.456-23.498,23.498L 256.97,297.135 c0,13.069, 10.456,20.911, 23.498,20.911L 285.696,318.046
c 13.069,0, 23.498-10.456, 23.498-20.911l0-232.502 c0-13.069-10.456-23.498-23.498-23.498L 280.468,41.135 z" horiz-adv-x="404.211" />
<glyph unicode="&#xe006;" d="M 438.414,163.698l 63.033,63.033l0-186.311 c0-38.372-30.151-68.494-65.764-68.494L 65.764-28.103 c-38.372,0-65.764,30.151-65.764,68.494L0,407.58 C0,445.924, 30.151,476.075, 65.764,476.075l 375.381,0 l0,0
l-63.033-63.033L 87.694,413.042 c-13.71,0-24.661-10.951-24.661-24.661l0-326.059 c0-13.71, 10.951-24.661, 24.661-24.661l 326.059,0 c 13.71,0, 24.661,10.951, 24.661,24.661L 438.414,163.698 z M 306.887,119.865l-65.764,65.764l-24.661-90.425
L 306.887,119.865z M 328.818,141.796l 213.732,213.732L 476.757,421.262L 263.054,210.29L 328.818,141.796z M 567.182,377.429l 30.151,30.151L 528.839,476.075l-30.151-30.151L 567.182,377.429z" horiz-adv-x="597.333" />
<glyph unicode="&#xe007;" d="M 58.88,477.44L 511.968,24.384L 451.264-36.32L-1.824,416.736zM -1.824,28.768L 451.232,481.824L 511.936,421.152L 58.88-31.936z" />
<glyph unicode="&#x20;" horiz-adv-x="256" />
</font></defs></svg> </font></defs></svg>

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Binary file not shown.

View File

@ -24,9 +24,20 @@ define(function(require) {
} }
var id = keys.keyId.substring(8, keys.keyId.length); var id = keys.keyId.substring(8, keys.keyId.length);
dl.createDownload(keys.publicKeyArmored + keys.privateKeyArmored, id + '.asc', 'text/plain'); dl.createDownload({
content: keys.publicKeyArmored + keys.privateKeyArmored,
filename: id + '.asc',
contentType: 'text/plain'
}, onSave);
}); });
}; };
function onSave(err) {
if (err) {
console.error(err);
return;
}
}
}; };
return AccountCtrl; return AccountCtrl;

View File

@ -26,6 +26,7 @@ define(function(require) {
fillFields($scope.selected); fillFields($scope.selected);
$scope.updatePreview(); $scope.updatePreview();
} }
$scope.verifyTo();
}); });
function resetFields() { function resetFields() {
@ -60,7 +61,49 @@ define(function(require) {
} }
// //
// Editing // Editing headers
//
$scope.verifyTo = function() {
if (!$scope.to) {
resetDisplay();
return;
}
// set display to insecure while fetching keys
displayInsecure();
// check if to address is contained in known public keys
emailDao._keychain.getReceiverPublicKey($scope.to, function(err, key) {
if (err) {
console.error(err);
return;
}
// compare again since model could have changed during the roundtrip
if (key && key.userId === $scope.to) {
displaySecure();
$scope.$apply();
}
});
};
function resetDisplay() {
$scope.toSecure = undefined;
$scope.sendBtnText = undefined;
}
function displaySecure() {
$scope.toSecure = true;
$scope.sendBtnText = 'Send securely';
}
function displayInsecure() {
$scope.toSecure = false;
$scope.sendBtnText = 'Invite & send securely';
}
//
// Editing email body
// //
// generate key,iv for encryption preview // generate key,iv for encryption preview
@ -184,5 +227,22 @@ define(function(require) {
}; };
}); });
ngModule.directive('autoSize', function($parse) {
return {
require: 'ngModel',
link: function(scope, elm, attrs) {
var model = $parse(attrs.autoSize);
scope.$watch(model, function(value) {
if (!value) {
return;
}
var width = ((value.length + 2) * 8) + 'px';
elm.css('width', width);
});
}
};
});
return WriteCtrl; return WriteCtrl;
}); });

View File

@ -11,6 +11,7 @@
background-color: $label-back-color; background-color: $label-back-color;
color: $label-color; color: $label-color;
box-shadow: 0px 1px 0px $label-shadow-color; box-shadow: 0px 1px 0px $label-shadow-color;
transition: background-color 0.3s;
&[data-icon]:before { &[data-icon]:before {
padding-right: 0.5em padding-right: 0.5em

View File

@ -24,8 +24,8 @@
color: $color-grey; color: $color-grey;
} }
.address-input { input {
width: 90%; margin-left: 0.3em;
} }
} }

View File

@ -14,7 +14,7 @@
<input type="password" ng-model="passphrase" ng-change="change()" ng-class="{error:incorrect}" placeholder="Passphrase" tabindex="1" focus-me="true"> <input type="password" ng-model="passphrase" ng-change="change()" ng-class="{error:incorrect}" placeholder="Passphrase" tabindex="1" focus-me="true">
</div> </div>
<div> <div>
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!buttonEnabled" tabindex="2">Unlock</button> <button type="submit" ng-click="confirmPassphrase()" class="btn" data-icon="&#xe009;" ng-disabled="!buttonEnabled" tabindex="2">Unlock</button>
</div> </div>
</form> </form>
</div><!--/content--> </div><!--/content-->

View File

@ -8,8 +8,8 @@
<div class="headers"> <div class="headers">
<p class="subject" ng-click="closeReadMode()">{{selected.subject || 'No subject'}}</p> <p class="subject" ng-click="closeReadMode()">{{selected.subject || 'No subject'}}</p>
<p class="date">{{selected.sentDate | date:'EEEE, MMM d, yyyy h:mm a'}}</p> <p class="date">{{selected.sentDate | date:'EEEE, MMM d, yyyy h:mm a'}}</p>
<p class="address">From: <span class="label">{{selected.from[0].name || selected.from[0].address}}</span></p> <p class="address">From: <span class="label" data-icon-append="&#xe009;">{{selected.from[0].name || selected.from[0].address}}</span></p>
<p class="address">To: <span class="label" ng-repeat="t in selected.to">{{t.address}} </span></p> <p class="address">To: <span class="label" data-icon-append="&#xe009;" ng-repeat="t in selected.to">{{t.address}} </span></p>
<div ng-switch="selected.cc !== undefined"> <div ng-switch="selected.cc !== undefined">
<p class="address" ng-switch-when="true"> <p class="address" ng-switch-when="true">
CC: <span class="label" ng-repeat="t in selected.cc">{{t.address}} </span> CC: <span class="label" ng-repeat="t in selected.cc">{{t.address}} </span>

View File

@ -9,11 +9,11 @@
<div class="headers"> <div class="headers">
<p> <p>
<span>To:</span> <span>To:</span>
<input type="email" ng-model="to" class="address-input" tabindex="1" focus-me="writerOpen"> <input type="email" ng-model="to" ng-change="verifyTo()" ng-class="{'label': toSecure === true, 'label label-primary': toSecure === false}" tabindex="1" focus-me="writerOpen" auto-size="to" spellcheck="false">
</p> </p>
<p> <p>
<span>Cc:</span> <span>Cc:</span>
<input type="email" ng-model="cc" class="address-input" tabindex="2" disabled> <input type="email" ng-model="cc" tabindex="2" disabled>
</p> </p>
</div><!--/.address-headers--> </div><!--/.address-headers-->
@ -37,7 +37,7 @@
</div><!--/.body--> </div><!--/.body-->
<div class="send-control"> <div class="send-control">
<button ng-click="sendToOutbox()" class="btn" ng-disabled="!to" tabindex="5">Send securely</button> <button ng-click="sendToOutbox()" class="btn" data-icon="{{(toSecure === false) ? '&#xe001;' : (toSecure === true) ? '&#xe009;' : ''}}" ng-disabled="!to" tabindex="5">{{sendBtnText || 'Send'}}</button>
</div> </div>
</div><!--/.write-view--> </div><!--/.write-view-->