Added google token, modified admin attribute, email is now username and old email is just plain email, no longer a primary key, first name and last name are just name now

This commit is contained in:
Sahat Yalkabov
2013-12-05 22:42:20 -05:00
parent 3e41002cf2
commit 0c842286ef

View File

@ -2,12 +2,12 @@ var mongoose = require('mongoose'),
bcrypt = require('bcrypt');
var userSchema = new mongoose.Schema({
email: { type: String, unique: true },
admin: { type: Boolean, default: false },
firstName: String,
lastName: String,
username: { type: String, unique: true },
email: String,
name: String,
password: String,
tokens: {
google: String,
facebook: String,
foursquare: String,
twitter: String,
@ -15,7 +15,8 @@ var userSchema = new mongoose.Schema({
},
provider: String,
facebook: String,
google: String
google: String,
isAdmin: Boolean,
});
userSchema.path('password').validate(function(password) {
@ -62,4 +63,4 @@ userSchema.methods.comparePassword = function(candidatePassword, cb) {
});
};
module.exports = mongoose.model('User', userSchema);
module.exports = mongoose.model('User', userSchema);