removed required:true from firstname and lastname
This commit is contained in:
@ -3,10 +3,10 @@ var mongoose = require('mongoose'),
|
||||
|
||||
var userSchema = new mongoose.Schema({
|
||||
email: { type: String, unique: true },
|
||||
firstName: { type: String, required: true},
|
||||
lastName: { type: String, required: true},
|
||||
password: String,
|
||||
admin: { type: Boolean, default: false },
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
password: String,
|
||||
provider: String,
|
||||
facebook: String,
|
||||
google: String
|
||||
@ -22,6 +22,16 @@ userSchema.path('email').validate(function(email) {
|
||||
return email.length;
|
||||
}, 'Email cannot be blank');
|
||||
|
||||
userSchema.path('firstName').validate(function(firstName) {
|
||||
if (this.provider) return true;
|
||||
return firstName.length;
|
||||
}, 'First Name cannot be blank');
|
||||
|
||||
userSchema.path('lastName').validate(function(lastName) {
|
||||
if (this.provider) return true;
|
||||
return lastName.length;
|
||||
}, 'Last Name cannot be blank');
|
||||
|
||||
userSchema.pre('save', function(next) {
|
||||
var user = this;
|
||||
var SALT_FACTOR = 5;
|
||||
|
@ -1,8 +1,6 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
|
||||
|
||||
.main
|
||||
h3
|
||||
| Please Login, or
|
||||
|
Reference in New Issue
Block a user