This leads to the LTI user lookup always failing (which is what should happen for the initial LTI login, but not for subsequent logins). The error in Discourse looks like this to users:
And stack trace pinpointing that this is coming from the call to User.find_or_initialize_bylooks like:
Tracking this to the Discourse User model, it seems the changes to support multiple emails mean that past code using Rails find methods to look for email won't work anymore. From looking at git blame, this appears related to changes in https://github.com/discourse/discourse/pull/4977 to enable multiple email addresses.
This PR works around by using the monkey-patched find methods on User related to email and username lookups, and then manually checks that both find the same record.
This leads to the LTI user lookup always failing (which is what should happen for the initial LTI login, but not for subsequent logins). The error in Discourse looks like this to users:
And stack trace pinpointing that this is coming from the call to
User.find_or_initialize_by
looks like:Tracking this to the Discourse
User
model, it seems the changes to support multiple emails mean that past code using Rails find methods to look for email won't work anymore. From looking at git blame, this appears related to changes in https://github.com/discourse/discourse/pull/4977 to enable multiple email addresses.This PR works around by using the monkey-patched find methods on
User
related to email and username lookups, and then manually checks that both find the same record.