Skip to content

Commit

Permalink
fix: CAS user merge not working (#32444)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc authored and matheusbsilva137 committed May 31, 2024
1 parent 147441a commit 8d9148b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cuddly-owls-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed an issue that prevented CAS users from being merged with existing user data on login
2 changes: 1 addition & 1 deletion apps/meteor/server/lib/cas/findExistingCASUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const findExistingCASUser = async (username: string): Promise<IUser | und
// It'll also allow non-CAS users to switch to CAS based login
// #TODO: Remove regex based search
const regex = new RegExp(`^${username}$`, 'i');
const user = await Users.findOne({ regex });
const user = await Users.findOne({ username: regex });
if (user) {
// Update the user's external_id to reflect this new username.
await Users.updateOne({ _id: user._id }, { $set: { 'services.cas.external_id': username } });
Expand Down

0 comments on commit 8d9148b

Please sign in to comment.