From 746c06e24a25ca69ff5911c12ef42f138ea65eba Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Tue, 29 Jul 2014 14:13:00 +0200 Subject: [PATCH] Link PGP key in plaintext suffix --- src/js/app-config.js | 2 +- src/js/controller/write.js | 2 +- src/js/dao/email-dao.js | 4 ++++ test/integration/email-dao-test.js | 6 ++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/js/app-config.js b/src/js/app-config.js index 72ef5e9..84722f4 100644 --- a/src/js/app-config.js +++ b/src/js/app-config.js @@ -106,7 +106,7 @@ define(function(require) { invitationSubject: 'Invitation to a private conversation', invitationMessage: 'Hi,\n\nI use Whiteout Mail to send and receive encrypted email. I would like to exchange encrypted messages with you as well.\n\nPlease install the Whiteout Mail application. This application makes it easy to read and write messages securely with PGP encryption applied.\n\nGo to the Whiteout Networks homepage to learn more and to download the application: https://whiteout.io\n\n', message: 'Hi,\n\nthis is a private conversation. To read my encrypted message below, simply open it in Whiteout Mail.\nOpen Whiteout Mail: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg\n\n\n', - signature: '\n\n\n--\nSent from Whiteout Mail - Email encryption for the rest of us\nhttps://whiteout.io\n\n', + signature: '\n\n\n--\nSent from Whiteout Mail - Email encryption for the rest of us: https://whiteout.io\n\nMy PGP key: ', webSite: 'http://whiteout.io', verificationSubject: '[whiteout] New public key uploaded', sendBtnClear: 'Send', diff --git a/src/js/controller/write.js b/src/js/controller/write.js index da0a6b4..d2f1e33 100644 --- a/src/js/controller/write.js +++ b/src/js/controller/write.js @@ -369,7 +369,7 @@ define(function(require) { cc: $scope.cc.filter(filterEmptyAddresses), bcc: $scope.bcc.filter(filterEmptyAddresses), subject: $scope.subject.trim() ? $scope.subject.trim() : str.fallbackSubject, // Subject line, or the fallback subject, if nothing valid was entered - body: $scope.body.trim() + (!$scope.sendBtnSecure ? str.signature : ''), // use parsed plaintext body + body: $scope.body.trim(), // use parsed plaintext body attachments: $scope.attachments, sentDate: new Date(), headers: {} diff --git a/src/js/dao/email-dao.js b/src/js/dao/email-dao.js index 6da3cb0..4e7dc06 100644 --- a/src/js/dao/email-dao.js +++ b/src/js/dao/email-dao.js @@ -1024,6 +1024,10 @@ define(function(require) { return; } self.busy(); + + // add suffix to plaintext mail + options.email.body += str.signature + config.cloudUrl + '/' + self._account.emailAddress; + // mime encode, sign and send email via smtp self._pgpMailer.send({ smtpclient: options.smtpclient, // filled solely in the integration test, undefined in normal usage diff --git a/test/integration/email-dao-test.js b/test/integration/email-dao-test.js index 51a3fcf..70cbe9e 100644 --- a/test/integration/email-dao-test.js +++ b/test/integration/email-dao-test.js @@ -9,7 +9,9 @@ define(function(require) { appController = require('js/app-controller'), mailreader = require('mailreader'), openpgp = require('openpgp'), - PgpMailer = require('pgpmailer'); + PgpMailer = require('pgpmailer'), + config = require('js/app-config').config, + str = require('js/app-config').string; describe('Email DAO integration tests', function() { this.timeout(100000); @@ -868,7 +870,7 @@ define(function(require) { expect(message.signed).to.be.true; expect(message.signaturesValid).to.be.true; expect(message.attachments.length).to.equal(0); - expect(message.body).to.equal(expectedBody); + expect(message.body).to.equal(expectedBody + str.signature + config.cloudUrl + '/' + testAccount.user); done(); }); };