Check for already verified user id on publicKey.verify()

This commit is contained in:
Tankred Hase
2016-06-14 13:13:34 +02:00
parent a60d8b86a9
commit 1ab934da31
3 changed files with 214 additions and 31 deletions

View File

@@ -136,6 +136,11 @@ class PublicKey {
if (!key) {
util.throw(404, 'User id not found');
}
// check if user ids of this key have already been verified in another key
let verified = yield this.getVerified(key);
if (verified) {
util.throw(304, 'Key for this user already exists');
}
// flag the user id as verified
yield this._mongo.update(query, {
'userIds.$.verified': true,