Allow passwords to be all numbers
Allow number passwords by converting number to string before hashing.
This commit is contained in:
parent
aa47f79ca6
commit
84a77071ea
|
@ -604,8 +604,8 @@ module.exports = function(User) {
|
|||
};
|
||||
|
||||
UserModel.setter.password = function(plain) {
|
||||
if (typeof plain !== 'string') {
|
||||
return;
|
||||
if (typeof plain === 'number') {
|
||||
plain = plain.toString();
|
||||
}
|
||||
if (plain.indexOf('$2a$') === 0 && plain.length === 60) {
|
||||
// The password is already hashed. It can be the case
|
||||
|
|
Loading…
Reference in New Issue