Add upload, update and removal for single user IDs (emails)

This commit is contained in:
Martin Hauck
2019-02-14 18:11:37 +01:00
parent 1651571d36
commit 02adaad939
9 changed files with 274 additions and 95 deletions

View File

@@ -56,15 +56,15 @@ class Email {
* @param {Object} origin origin of the server
* @yield {Object} reponse object containing SMTP info
*/
async send({template, userId, keyId, origin}) {
async send({template, userId, keyId, origin, publicKeyArmored}) {
const compiled = template({
name: userId.name,
baseUrl: util.url(origin),
keyId,
nonce: userId.nonce
});
if (this._usePGPEncryption && userId.publicKeyArmored) {
compiled.text = await this._pgpEncrypt(compiled.text, userId.publicKeyArmored);
if (this._usePGPEncryption && publicKeyArmored) {
compiled.text = await this._pgpEncrypt(compiled.text, publicKeyArmored);
}
const sendOptions = {
from: {name: this._sender.name, address: this._sender.email},

View File

@@ -2,10 +2,10 @@
exports.verifyKey = ({name, baseUrl, keyId, nonce}) => ({
subject: `Verify Your Key`,
text: `Hello ${name},\n\nplease click here to verify your key:\n\n${baseUrl}/api/v1/key?op=verify&keyId=${keyId}&nonce=${nonce}`,
text: `Hello ${name},\n\nplease click here to verify your email address:\n\n${baseUrl}/api/v1/key?op=verify&keyId=${keyId}&nonce=${nonce}`,
});
exports.verifyRemove = ({name, baseUrl, keyId, nonce}) => ({
subject: `Verify Key Removal`,
text: `Hello ${name},\n\nplease click here to verify the removal of your key:\n\n${baseUrl}/api/v1/key?op=verifyRemove&keyId=${keyId}&nonce=${nonce}`,
text: `Hello ${name},\n\nplease click here to verify the removal of your email address:\n\n${baseUrl}/api/v1/key?op=verifyRemove&keyId=${keyId}&nonce=${nonce}`,
});