catalyst / moodle-auth_saml2

SAML done 100% in Moodle, fast, simple, secure
https://moodle.org/plugins/auth_saml2
70 stars 132 forks source link

allowaccountssameemail setting is ignored due to a missing of global $CFG definition #736

Closed fhuebler closed 1 year ago

fhuebler commented 1 year ago

Our database servers were busy with the following query:

SELECT ? FROM mdl_user WHERE lower(email) collate utf?mb?_bin = lower(?) AND mnethostid = ? AND deleted = ? AND username <> ? limit ?, ?

We wondered why this query is called at every login although CFG->allowaccountssameemail =1 is set.

Starting at auth/saml2/classes/auth.php function saml_login_complete() we ended up at function update_user_record_from_attribute_map() and we found that the setting was ignored. empty($CFG->allowaccountssameemail) was always true because global $CFG definiton was missing.

danmarsden commented 1 year ago

thanks for the pr - merged.