1
0
mirror of https://github.com/Foltik/Shimapan synced 2025-01-07 08:42:49 -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'); const mongoose = require('mongoose');
var passportLocalMongoose = require('passport-local-mongoose'); const passportLocalMongoose = require('passport-local-mongoose');
const config = require('config');
var UserSchema = mongoose.Schema({ const UserSchema = mongoose.Schema({
username: { username: {
type: String, type: String,
unique: true, unique: true,
@ -36,8 +37,8 @@ var UserSchema = mongoose.Schema({
}); });
UserSchema.plugin(passportLocalMongoose, { UserSchema.plugin(passportLocalMongoose, {
saltlen: 64, saltlen: config.get('User.Password.saltLength'),
iterations: 10000, iterations: config.get('User.Password.hashIterations'),
limitAttempts: true limitAttempts: true
}); });

View File

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

View File

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