Restrict addition of signatures

Sending an email to the primary userID to select which signatures to add when new signatures are uploaded.
This commit is contained in:
Simon Vareille
2020-02-10 18:10:10 +01:00
parent d0083a4f57
commit 5a05cecdb8
6 changed files with 135 additions and 17 deletions

View File

@@ -53,12 +53,13 @@ class Email {
* @param {Object} template the email template function to use
* @param {Object} userId recipient user id object: { name:'Jon Smith', email:'j@smith.com', publicKeyArmored:'...' }
* @param {string} keyId key id of public key
* @param {Object} data data used by template
* @param {Object} origin origin of the server
* @yield {Object} reponse object containing SMTP info
*/
async send({template, userId, keyId, origin, publicKeyArmored}) {
async send({template, userId, keyId, data, origin, publicKeyArmored}) {
const compiled = template({
...userId,
...data,
origin,
keyId
});

View File

@@ -18,4 +18,12 @@ function verifyRemove(ctx, {name, email, nonce, origin, keyId}) {
};
}
module.exports = {verifyKey, verifyRemove};
function confirmNewSigs(ctx, {name, sigsNb, nonce, origin, keyId}) {
const link = `${util.url(origin)}/api/v1/key?op=confirmSignatures&keyId=${keyId}&nonce=${nonce}`;
return {
subject: ctx.__('confirm_signatures_subject'),
text: ctx.__('confirm_signatures_text', [name, sigsNb, link, origin.host])
};
}
module.exports = {verifyKey, verifyRemove, confirmNewSigs};