diff --git a/app/authentication/server/lib/restrictLoginAttempts.ts b/app/authentication/server/lib/restrictLoginAttempts.ts index 01e8526fc74fd..a746d6e7938e4 100644 --- a/app/authentication/server/lib/restrictLoginAttempts.ts +++ b/app/authentication/server/lib/restrictLoginAttempts.ts @@ -21,7 +21,8 @@ export const notifyFailedLogin = async (ipOrUsername: string, blockedUntil: Date return; } // verify channel exists - const room = await Rooms.findOneByName(channelToNotify); + // to avoid issues when "fname" is presented in the UI, check if the name matches it as well + const room = await Rooms.findOneByNameOrFname(channelToNotify); if (!room) { /* @ts-expect-error */ logger.error('Cannot notify failed logins: channel provided doesn\'t exists'); diff --git a/app/models/server/raw/Rooms.js b/app/models/server/raw/Rooms.js index 4d03e2b5aea4e..3fd237b4b37a8 100644 --- a/app/models/server/raw/Rooms.js +++ b/app/models/server/raw/Rooms.js @@ -365,4 +365,8 @@ export class RoomsRaw extends BaseRaw { return this.update(query, update, { multi: true }); } + + findOneByNameOrFname(name, options = {}) { + return this.col.findOne({ $or: [{ name }, { fname: name }] }, options); + } }