From 95292a2e559271d00eaecc3ba5acb2ba6416f7b0 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 21 Sep 2017 15:06:42 +0100 Subject: [PATCH] Add unique index to token properties --- services/web/app/coffee/models/Project.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/models/Project.coffee b/services/web/app/coffee/models/Project.coffee index f59581bd69..46a6711581 100644 --- a/services/web/app/coffee/models/Project.coffee +++ b/services/web/app/coffee/models/Project.coffee @@ -43,11 +43,13 @@ ProjectSchema = new Schema tokens : readOnly : { type: String, - default: generateToken(14) + default: generateToken(14), + index: {unique: true} } readAndWrite : { type: String, default: Math.random().toString().slice(2, 10) + generateToken(12) + index: {unique: true} } tokenAccessReadOnly_refs : [ type:ObjectId, ref:'User' ] tokenAccessReadAndWrite_refs : [ type:ObjectId, ref:'User' ]