Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 8f09b8b

Browse files
author
Kentaro Wakayama
committed
Add check of password and salt in user auth
1 parent c6a8a9b commit 8f09b8b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/models/user.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ UserSchema.methods.hashPassword = function(password) {
104104
* Create instance method for authenticating user
105105
*/
106106
UserSchema.methods.authenticate = function(password) {
107+
if (!this.password || !this.salt) {
108+
return false;
109+
}
107110
return this.password === this.hashPassword(password);
108111
};
109112

0 commit comments

Comments
 (0)