Skip to content
Snippets Groups Projects
Unverified Commit 760ab4be authored by Pierre Lehnen's avatar Pierre Lehnen Committed by GitHub
Browse files

fix: CAS user merge not working (#32444)

parent fa55c49a
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': patch
---
Fixed an issue that prevented CAS users from being merged with existing user data on login
...@@ -18,7 +18,7 @@ export const findExistingCASUser = async (username: string): Promise<IUser | und ...@@ -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 // It'll also allow non-CAS users to switch to CAS based login
// #TODO: Remove regex based search // #TODO: Remove regex based search
const regex = new RegExp(`^${username}$`, 'i'); const regex = new RegExp(`^${username}$`, 'i');
const user = await Users.findOne({ regex }); const user = await Users.findOne({ username: regex });
if (user) { if (user) {
// Update the user's external_id to reflect this new username. // Update the user's external_id to reflect this new username.
await Users.updateOne({ _id: user._id }, { $set: { 'services.cas.external_id': username } }); await Users.updateOne({ _id: user._id }, { $set: { 'services.cas.external_id': username } });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment