mirror of
https://github.com/Foltik/Shimapan
synced 2025-01-05 15:58:03 -05:00
Add salt length and hash iterations config for User model
This commit is contained in:
parent
c851d1d808
commit
1d2a493258
@ -1,7 +1,8 @@
|
||||
var mongoose = require('mongoose');
|
||||
var passportLocalMongoose = require('passport-local-mongoose');
|
||||
const mongoose = require('mongoose');
|
||||
const passportLocalMongoose = require('passport-local-mongoose');
|
||||
const config = require('config');
|
||||
|
||||
var UserSchema = mongoose.Schema({
|
||||
const UserSchema = mongoose.Schema({
|
||||
username: {
|
||||
type: String,
|
||||
unique: true,
|
||||
@ -36,8 +37,8 @@ var UserSchema = mongoose.Schema({
|
||||
});
|
||||
|
||||
UserSchema.plugin(passportLocalMongoose, {
|
||||
saltlen: 64,
|
||||
iterations: 10000,
|
||||
saltlen: config.get('User.Password.saltLength'),
|
||||
iterations: config.get('User.Password.hashIterations'),
|
||||
limitAttempts: true
|
||||
});
|
||||
|
||||
|
@ -22,6 +22,10 @@
|
||||
"Username": {
|
||||
"maxLength": 36,
|
||||
"restrictedChars": "\\s"
|
||||
},
|
||||
"Password": {
|
||||
"saltLength": 64,
|
||||
"hashIterations": 25000
|
||||
}
|
||||
},
|
||||
"Log": {
|
||||
|
@ -11,5 +11,11 @@
|
||||
},
|
||||
"Log": {
|
||||
"httpLevel": "dev"
|
||||
},
|
||||
"User": {
|
||||
"Password": {
|
||||
"saltLength": 8,
|
||||
"hashIterations": 1
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user