Comparing version 1.0.19 to 1.0.20
{ | ||
"name": "ab-models", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -26,4 +26,7 @@ var bcrypt = require('bcrypt-nodejs'); | ||
userSchema.pre('save', function (next) { | ||
console.log('empty state 1', this.isNew); | ||
//emptyState(this, next); | ||
if (this.isNew) { | ||
emptyState(this, next); | ||
} else { | ||
next(); | ||
} | ||
}); | ||
@@ -48,4 +51,6 @@ | ||
userSchema.pre('save', function(next) { | ||
this.apiKey = crypto.randomBytes(4).toString('hex'); | ||
this.apiSecret = crypto.randomBytes(16).toString('hex'); | ||
if (this.isNew) { | ||
this.apiKey = crypto.randomBytes(4).toString('hex'); | ||
this.apiSecret = crypto.randomBytes(16).toString('hex'); | ||
} | ||
next(); | ||
@@ -52,0 +57,0 @@ }); |
10118
302