Make it work
This commit is contained in:
parent
d95a7dd13a
commit
307d2a2d53
2 changed files with 12 additions and 4 deletions
14
auth.php
14
auth.php
|
@ -59,8 +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;
|
||||
return $password == $user->password || validate_internal_user_password($user, $password);
|
||||
}
|
||||
|
||||
if (is_numeric($username) && ((string)(int) $username) != $username) {
|
||||
return user_login((string)(int) $username, $password);
|
||||
}
|
||||
|
@ -133,6 +134,13 @@ class auth_plugin_crewauth extends auth_plugin_base {
|
|||
return true;
|
||||
}
|
||||
|
||||
function loginpage_hook() {
|
||||
global $CFG, $DB;
|
||||
if ($_POST["username"] && is_numeric($_POST["username"])) {
|
||||
$user = $DB->get_record('user', array('username'=>(string)(int)$_POST["username"], 'mnethostid'=>$CFG->mnet_localhost_id));
|
||||
$user->auth = $this->authtype;
|
||||
$DB->update_record("user", $user, $bulk=false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,5 +25,5 @@
|
|||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2022041900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2022041200; // Requires this Moodle version.
|
||||
$plugin->requires = 2016052300; // Requires this Moodle version.
|
||||
$plugin->component = 'auth_crewauth'; // Full name of the plugin (used for diagnostics)
|
||||
|
|
Loading…
Reference in a new issue