Skip to content

Commit

Permalink
fix: prevent password reset on disabled account
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel authored Aug 29, 2024
1 parent d1b4c8c commit b9fb17d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/models/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ module.exports = class User extends Model {
})

if (usr) {
if (!usr.isActive) {
throw new WIKI.Error.AuthAccountBanned()
}

await WIKI.models.users.query().patch({
password: newPassword,
mustChangePwd: false
Expand Down Expand Up @@ -527,6 +531,9 @@ module.exports = class User extends Model {
if (!usr) {
WIKI.logger.debug(`Password reset attempt on nonexistant local account ${email}: [DISCARDED]`)
return
} else if (!usr.isActive) {
WIKI.logger.debug(`Password reset attempt on disabled local account ${email}: [DISCARDED]`)
return
}
const resetToken = await WIKI.models.userKeys.generateToken({
userId: usr.id,
Expand Down

0 comments on commit b9fb17d

Please sign in to comment.