1
0
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:
Jack Foltz 2018-07-29 19:38:29 -04:00
parent c851d1d808
commit 1d2a493258
Signed by: foltik
GPG Key ID: 303F88F996E95541
3 changed files with 16 additions and 5 deletions

View File

@ -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
});

View File

@ -22,6 +22,10 @@
"Username": {
"maxLength": 36,
"restrictedChars": "\\s"
},
"Password": {
"saltLength": 64,
"hashIterations": 25000
}
},
"Log": {

View File

@ -11,5 +11,11 @@
},
"Log": {
"httpLevel": "dev"
},
"User": {
"Password": {
"saltLength": 8,
"hashIterations": 1
}
}
}