Skip to content

Commit 9d0b539

Browse files
committed
Merge branch 'release-2.12.4' into develop
2 parents 264ea8e + 1298dea commit 9d0b539

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5.js-web-editor",
3-
"version": "2.12.3",
3+
"version": "2.12.4",
44
"description": "The web editor for p5.js.",
55
"scripts": {
66
"clean": "rimraf dist",

server/models/user.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,16 @@ userSchema.set('toJSON', {
162162
userSchema.methods.comparePassword = async function comparePassword(
163163
candidatePassword
164164
) {
165-
return bcrypt.compare(candidatePassword, this.password);
165+
if (!this.password) {
166+
throw new Error('No password is set for this user.');
167+
}
168+
169+
try {
170+
return await bcrypt.compare(candidatePassword, this.password);
171+
} catch (error) {
172+
console.error('Password comparison failed!', error);
173+
return false;
174+
}
166175
};
167176

168177
/**

0 commit comments

Comments
 (0)