Skip to content

Commit b9fb17d

Browse files
authored
fix: prevent password reset on disabled account
1 parent d1b4c8c commit b9fb17d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/models/users.js

+7
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ module.exports = class User extends Model {
499499
})
500500

501501
if (usr) {
502+
if (!usr.isActive) {
503+
throw new WIKI.Error.AuthAccountBanned()
504+
}
505+
502506
await WIKI.models.users.query().patch({
503507
password: newPassword,
504508
mustChangePwd: false
@@ -527,6 +531,9 @@ module.exports = class User extends Model {
527531
if (!usr) {
528532
WIKI.logger.debug(`Password reset attempt on nonexistant local account ${email}: [DISCARDED]`)
529533
return
534+
} else if (!usr.isActive) {
535+
WIKI.logger.debug(`Password reset attempt on disabled local account ${email}: [DISCARDED]`)
536+
return
530537
}
531538
const resetToken = await WIKI.models.userKeys.generateToken({
532539
userId: usr.id,

0 commit comments

Comments
 (0)