Allow passwords to be all numbers

Allow number passwords by converting number to string before hashing.
This commit is contained in:
Brian Ross 2016-05-11 09:05:33 -07:00
parent aa47f79ca6
commit 84a77071ea
1 changed files with 2 additions and 2 deletions

View File

@ -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