|
|
@@ -2,6 +2,7 @@ module.exports = function(crowi) {
|
|
|
var debug = require('debug')('crowi:models:user')
|
|
|
, mongoose = require('mongoose')
|
|
|
, mongoosePaginate = require('mongoose-paginate')
|
|
|
+ , uniqueValidator = require('mongoose-unique-validator')
|
|
|
, crypto = require('crypto')
|
|
|
, async = require('async')
|
|
|
, ObjectId = mongoose.Schema.Types.ObjectId
|
|
|
@@ -31,7 +32,7 @@ module.exports = function(crowi) {
|
|
|
googleId: String,
|
|
|
name: { type: String },
|
|
|
username: { type: String, index: true },
|
|
|
- email: { type: String, required: true, index: true },
|
|
|
+ email: { type: String, required: true, unique: true },
|
|
|
introduction: { type: String },
|
|
|
password: String,
|
|
|
apiToken: String,
|
|
|
@@ -46,6 +47,7 @@ module.exports = function(crowi) {
|
|
|
admin: { type: Boolean, default: 0, index: true }
|
|
|
});
|
|
|
userSchema.plugin(mongoosePaginate);
|
|
|
+ userSchema.plugin(uniqueValidator);
|
|
|
|
|
|
userEvent.on('activated', userEvent.onActivated);
|
|
|
|