We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72035d7 commit c323b42Copy full SHA for c323b42
src/Routers/UsersRouter.js
@@ -127,9 +127,12 @@ export class UsersRouter extends ClassesRouter {
127
user = results[0];
128
}
129
130
- const hashedPassword =
131
- typeof user.password === 'string' ? user.password : passwordCrypto.dummyHash;
132
- return passwordCrypto.compare(password, hashedPassword);
+ const hasStoredPassword =
+ typeof user.password === 'string' && user.password.length > 0;
+ const hashedPassword = hasStoredPassword ? user.password : passwordCrypto.dummyHash;
133
+ return passwordCrypto
134
+ .compare(password, hashedPassword)
135
+ .then(correct => (hasStoredPassword ? correct : false));
136
})
137
.then(correct => {
138
isValidPassword = correct;
0 commit comments