mirror of
https://github.com/SREd-URV/moodle-auth_ip.git
synced 2026-05-16 21:41:30 +02:00
Merge pull request #8 from CaxtonTaylor/patch-1
Modify auth.php IP evaluation to use lib/moodlelib.php:getremoteaddr() function.
This commit is contained in:
2
auth.php
2
auth.php
@@ -55,7 +55,7 @@ class auth_plugin_ip extends auth_plugin_manual {
|
|||||||
global $DB, $CFG;
|
global $DB, $CFG;
|
||||||
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)))) {
|
||||||
// Check if IP is one of the restricted ones.
|
// Check if IP is one of the restricted ones.
|
||||||
$userIp = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
|
$userIp = getremoteaddr();
|
||||||
|
|
||||||
if (isset($userIp) && $this->is_ip_valid($userIp)) {
|
if (isset($userIp) && $this->is_ip_valid($userIp)) {
|
||||||
return validate_internal_user_password($user, $password);
|
return validate_internal_user_password($user, $password);
|
||||||
|
|||||||
Reference in New Issue
Block a user