Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/authentication/server/lib/restrictLoginAttempts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 4 additions & 0 deletions app/models/server/raw/Rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}