Updated user schema (provider field was not used)

pull/2/head
Sahat Yalkabov 2014-02-01 03:34:18 -05:00
parent e820b9f02a
commit c0e1a1129a
1 changed files with 5 additions and 2 deletions

View File

@ -5,12 +5,11 @@ var userSchema = new mongoose.Schema({
email: { type: String, unique: true },
password: String,
tokens: Array,
provider: String,
facebook: { type: String, unique: true, sparse: true },
twitter: { type: String, unique: true, sparse: true },
google: { type: String, unique: true, sparse: true },
github: { type: String, unique: true, sparse: true },
tokens: Array,
profile: {
name: { type: String, default: '' },
@ -21,6 +20,10 @@ var userSchema = new mongoose.Schema({
}
});
/**
* Hash the password for security.
*/
userSchema.pre('save', function(next) {
var user = this;
var SALT_FACTOR = 5;