From bf9602fcbbc2e9e076f4e9491cefd354c4c1f484 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 20 Feb 2014 19:20:24 +0100 Subject: [PATCH] add lock icon to encrypted items in mail list, show key ID instead of fingerprints in reader, hide popover in writer --- src/js/controller/mail-list.js | 1 + src/js/controller/read.js | 16 ++++++++++------ src/js/controller/write.js | 10 +++++----- src/sass/components/_mail-list.scss | 15 +++++++++++++++ src/tpl/mail-list.html | 1 + src/tpl/read.html | 10 +++++----- src/tpl/write.html | 8 ++++---- 7 files changed, 41 insertions(+), 20 deletions(-) diff --git a/src/js/controller/mail-list.js b/src/js/controller/mail-list.js index db67bdf..1659a38 100644 --- a/src/js/controller/mail-list.js +++ b/src/js/controller/mail-list.js @@ -395,6 +395,7 @@ define(function(require) { this.sentDate = new Date('Thu Sep 19 2013 20:41:23 GMT+0200 (CEST)'); this.subject = 'Getting started'; // Subject line this.body = 'Here are a few pointers to help you get started with Whiteout Mail.\n\n# Write encrypted message\n- You can compose a message by clicking on the compose button on the upper right (keyboard shortcut is "n" for a new message or "r" to reply).\n- When typing the recipient\'s email address, secure recipients are marked with a blue label and insecure recipients are red.\n- When sending an email to insecure recipients, the default behavior for Whiteout Mail is to invite them to the service and only send the message content in an encrypted form, once they have joined.\n\n# Advanced features\n- To verify a recipient\'s PGP key, you can hover over the blue label containing their email address and their key fingerprint will be displayed.\n- To view your own key fingerprint, open the account view in the navigation bar on the left. You can compare these with your correspondants over a second channel such as a phonecall.\n\nWe hope this helped you to get started with Whiteout Mail.\n\nYour Whiteout Networks team'; // plaintext body + this.encrypted = true; }; var dummys = [new Email(true, true), new Email(true, false, true, true), new Email(false, true, true), new Email(false, true), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false)]; diff --git a/src/js/controller/read.js b/src/js/controller/read.js index e14ce25..e655605 100644 --- a/src/js/controller/read.js +++ b/src/js/controller/read.js @@ -17,7 +17,7 @@ define(function(require) { keychain = appController._keychain; // set default value so that the popover height is correct on init - $scope.fingerprint = 'XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX'; + $scope.keyId = 'XXXXXXXX'; $scope.state.read = { open: false, @@ -30,18 +30,22 @@ define(function(require) { return line.replace(/>/g, '').trim().length === 0; }; - $scope.getFingerprint = function(address) { - $scope.fingerprint = 'Fingerprint cannot be displayed. Public key not found for that user.'; + $scope.getKeyId = function(address) { + $scope.keyId = 'Key not found for that user.'; keychain.getReceiverPublicKey(address, function(err, pubkey) { if (err) { $scope.onError(err); return; } - var fpr = crypto.getFingerprint(pubkey.publicKey); - var formatted = fpr.slice(0, 4) + ' ' + fpr.slice(4, 8) + ' ' + fpr.slice(8, 12) + ' ' + fpr.slice(12, 16) + ' ' + fpr.slice(16, 20) + ' ' + fpr.slice(20, 24) + ' ' + fpr.slice(24, 28) + ' ' + fpr.slice(28, 32) + ' ' + fpr.slice(32, 36) + ' ' + fpr.slice(36); + if (!pubkey) { + return; + } - $scope.fingerprint = formatted; + var fpr = crypto.getFingerprint(pubkey.publicKey); + var formatted = fpr.slice(32); + + $scope.keyId = formatted; $scope.$apply(); }); }; diff --git a/src/js/controller/write.js b/src/js/controller/write.js index 2ac820a..9484c2c 100644 --- a/src/js/controller/write.js +++ b/src/js/controller/write.js @@ -17,7 +17,7 @@ define(function(require) { emailDao = appController._emailDao; // set default value so that the popover height is correct on init - $scope.fingerprint = 'XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX'; + $scope.keyId = 'XXXXXXXX'; // // Init @@ -130,17 +130,17 @@ define(function(require) { }); }; - $scope.getFingerprint = function(recipient) { - $scope.fingerprint = 'Fingerprint cannot be displayed. Public key not found for that user.'; + $scope.getKeyId = function(recipient) { + $scope.keyId = 'Key not found for that user.'; if (!recipient.key) { return; } var fpr = crypto.getFingerprint(recipient.key.publicKey); - var formatted = fpr.slice(0, 4) + ' ' + fpr.slice(4, 8) + ' ' + fpr.slice(8, 12) + ' ' + fpr.slice(12, 16) + ' ' + fpr.slice(16, 20) + ' ' + fpr.slice(20, 24) + ' ' + fpr.slice(24, 28) + ' ' + fpr.slice(28, 32) + ' ' + fpr.slice(32, 36) + ' ' + fpr.slice(36); + var formatted = fpr.slice(32); - $scope.fingerprint = formatted; + $scope.keyId = formatted; }; /** diff --git a/src/sass/components/_mail-list.scss b/src/sass/components/_mail-list.scss index 5538eeb..4d4f24e 100755 --- a/src/sass/components/_mail-list.scss +++ b/src/sass/components/_mail-list.scss @@ -11,6 +11,7 @@ } li { + position: relative; display: block; margin-bottom: 7px; padding: $padding-vertical $padding-horizontal; @@ -26,10 +27,20 @@ font-weight: normal; margin: 0; } + + .encrypted { + position: absolute; + color: $color-grey-medium; + line-height: 30px; + top: $padding-vertical; + right: $padding-vertical; + } + p { font-size: $font-size-small; margin: 0; } + .head { position: relative; padding-right: 6.5em; @@ -64,6 +75,7 @@ margin-left: -1.3em; } } + .body { color: $color-grey; height: 2.5em; @@ -122,6 +134,9 @@ h3 { color: $color-white; } + .encrypted { + color: $color-white; + } .head { .subject { color: $color-white; diff --git a/src/tpl/mail-list.html b/src/tpl/mail-list.html index 105b15e..20b008b 100644 --- a/src/tpl/mail-list.html +++ b/src/tpl/mail-list.html @@ -12,6 +12,7 @@