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:
parent
c851d1d808
commit
1d2a493258
@ -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
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
"Username": {
|
"Username": {
|
||||||
"maxLength": 36,
|
"maxLength": 36,
|
||||||
"restrictedChars": "\\s"
|
"restrictedChars": "\\s"
|
||||||
|
},
|
||||||
|
"Password": {
|
||||||
|
"saltLength": 64,
|
||||||
|
"hashIterations": 25000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Log": {
|
"Log": {
|
||||||
|
@ -11,5 +11,11 @@
|
|||||||
},
|
},
|
||||||
"Log": {
|
"Log": {
|
||||||
"httpLevel": "dev"
|
"httpLevel": "dev"
|
||||||
|
},
|
||||||
|
"User": {
|
||||||
|
"Password": {
|
||||||
|
"saltLength": 8,
|
||||||
|
"hashIterations": 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user