2017-10-09 22:01:02 -04:00
|
|
|
var mongoose = require('mongoose');
|
2017-10-18 13:31:08 -04:00
|
|
|
var passportLocalMongoose = require('passport-local-mongoose');
|
2017-10-09 22:01:02 -04:00
|
|
|
|
|
|
|
var UserSchema = mongoose.Schema({
|
|
|
|
username: {
|
|
|
|
type: String,
|
|
|
|
unique: true,
|
|
|
|
required: true
|
|
|
|
},
|
2018-07-26 19:40:42 -04:00
|
|
|
|
|
|
|
displayname: {
|
2018-01-15 15:29:32 -05:00
|
|
|
type: String,
|
|
|
|
unique: true,
|
|
|
|
required: true
|
|
|
|
},
|
2018-07-26 19:40:42 -04:00
|
|
|
|
|
|
|
scope: {
|
|
|
|
type: [String],
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
|
2017-10-14 15:13:50 -04:00
|
|
|
uploadCount: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
2018-07-26 19:40:42 -04:00
|
|
|
|
2017-10-14 15:13:50 -04:00
|
|
|
uploadSize: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
2018-07-26 19:40:42 -04:00
|
|
|
|
|
|
|
date: {
|
|
|
|
type: Date,
|
|
|
|
default: Date.now
|
|
|
|
}
|
2017-10-09 22:01:02 -04:00
|
|
|
});
|
|
|
|
|
2018-07-25 18:45:08 -04:00
|
|
|
UserSchema.plugin(passportLocalMongoose, {
|
2018-07-26 19:40:42 -04:00
|
|
|
saltlen: 64,
|
2018-07-25 18:45:08 -04:00
|
|
|
iterations: 10000,
|
|
|
|
limitAttempts: true
|
|
|
|
});
|
2017-10-09 22:01:02 -04:00
|
|
|
|
|
|
|
module.exports = mongoose.model('User', UserSchema);
|