Improve user_login
This commit is contained in:
parent
307d2a2d53
commit
07182c8e76
1 changed files with 3 additions and 1 deletions
4
auth.php
4
auth.php
|
@ -59,7 +59,9 @@ class auth_plugin_crewauth extends auth_plugin_base {
|
||||||
function user_login ($username, $password) {
|
function user_login ($username, $password) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
|
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) {
|
if (is_numeric($username) && ((string)(int) $username) != $username) {
|
||||||
|
|
Loading…
Reference in a new issue