Improve user_login

This commit is contained in:
Kumi 2022-08-21 06:29:56 +00:00
parent 307d2a2d53
commit 07182c8e76
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -59,7 +59,9 @@ class auth_plugin_crewauth extends auth_plugin_base {
function user_login ($username, $password) {
global $CFG, $DB;
if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
return $password == $user->password || validate_internal_user_password($user, $password);
# Rationale: It seems the password is hashed the first time this is called,
# but it still returns false. Calling it twice works around that.
return validate_internal_user_password($user, $password) || validate_internal_user_password($user, $password);
}
if (is_numeric($username) && ((string)(int) $username) != $username) {