Attempting to set up external MSSQL datbase to authenticate users (Moodle 3.6.4 (build 20190513) on CentOS 7 with PHP 7.2.18), appears almost successful.
Site Administration | Plugins | Authentication | Manage Authentication
"Test Settings" for "External database" passes (I assume, the list of field names is in green).
In 'auth/db/auth.php', under function user_login, the ELSE (Normal case: use external db for both usernames and passwords.), the correct query is set by this line of code:
$rs = $authdb->Execute("SELECT {$this->config->fieldpass} FROM {$this->config->table} WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."'");
and that correct query returns the fieldname followed by a space, the value, and another space. Then, $extpassword is set correctly.
Back to 'login/index.php':
$frm->username = trim(core_text::strtolower($frm->username));
is set to the correct username
However, under
if ($frm and isset($frm->username)) {
the line
if ($user) {
$user is set to null.
So, all attempts to login get: "Invalid login, please try again".
Please provide some troubleshooting ideas. Thanks!