start writing validations

This commit is contained in:
Michael Q Larson
2014-11-30 15:25:00 -08:00
parent 1accb225c6
commit ec5fea2eaa
3 changed files with 11 additions and 7 deletions

View File

@ -3,7 +3,7 @@ var crypto = require('crypto');
var mongoose = require('mongoose');
var userSchema = new mongoose.Schema({
email: { type: String, unique: true, lowercase: true },
email: { type: String, unique: true, lowercase: true, match: /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/ },
password: String,
facebook: String,
@ -21,7 +21,7 @@ var userSchema = new mongoose.Schema({
location: { type: String, default: '' },
website: { type: String, default: '' },
picture: { type: String, default: '' },
username: { type: String, default: '' }
username: { type: String, default: '', unique: true, match: /^[a-zA-Z0-9_]+$/ }
},
resetPasswordToken: String,