aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--models/User.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/models/User.js b/models/User.js
index 4d32941..9e6e52f 100644
--- a/models/User.js
+++ b/models/User.js
@@ -11,6 +11,12 @@ var mongoose = require('mongoose')
/**
* User schema
+ *
+ * statuscodes:
+ * 1: invited
+ * 2: unconfirmed
+ * 3: active
+ * 4: paying user
*/
var UserSchema = new Schema({
@@ -22,9 +28,11 @@ var UserSchema = new Schema({
salt: String,
accessToken: String,
facebook: {},
- twitter: {}
+ twitter: {},
+ status: { type: Number, default: 2 }
});
+
/**
* Virtuals
*/
@@ -37,9 +45,11 @@ UserSchema
this.hashed_password = this.encryptPassword(password)
}).get(function() { return this._password });
+
/**
* Validations
*/
+
var validatePrecenceOf = function (value) {
return value && value.length;
}
@@ -67,6 +77,7 @@ UserSchema.path('hashed_password').validate(function(hashed_password) {
return hashed_password.length;
}, 'Password cannot be blank');
+
/**
* Pre-save hook
*/