Merge pull request #1465 from FreeCodeCamp/fix/no-password
fix: exit early when password is non-string
This commit is contained in:
commit
66d5cc07e0
|
@ -544,6 +544,9 @@ module.exports = function(User) {
|
|||
this.settings.ttl = this.settings.ttl || DEFAULT_TTL;
|
||||
|
||||
UserModel.setter.password = function(plain) {
|
||||
if (typeof plain !== 'string') {
|
||||
return;
|
||||
}
|
||||
if (plain.indexOf('$2a$') === 0 && plain.length === 60) {
|
||||
// The password is already hashed. It can be the case
|
||||
// when the instance is loaded from DB
|
||||
|
|
Loading…
Reference in New Issue