moodle-auth_ip - simplified code for portability through Moodle versions. Extended availability from Moodle 2.4 to Moodle 2.7.

This commit is contained in:
Jordi Pujol-Ahullo
2014-07-25 22:46:24 +02:00
parent e9e6b9cb3b
commit 86d14bf068
2 changed files with 10 additions and 55 deletions

View File

@@ -31,12 +31,12 @@ defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir.'/authlib.php');
require_once($CFG->dirroot.'/auth/manual/auth.php');
/**
* Auth plugin to allow login only from restricted IPs.
*/
class auth_plugin_ip extends auth_plugin_base {
class auth_plugin_ip extends auth_plugin_manual {
/**
* Constructor
@@ -70,25 +70,6 @@ class auth_plugin_ip extends auth_plugin_base {
return false;
}
/**
* Updates the user's password.
*
* called when the user password is updated.
*
* @param object $user User table object (with system magic quotes)
* @param string $newpassword Plaintext password (with system magic quotes)
* @return boolean result
*
*/
function user_update_password($user, $newpassword) {
$user = get_complete_user_data('id', $user->id);
return update_internal_user_password($user, $newpassword);
}
function prevent_local_passwords() {
return false;
}
/**
* Returns true if this authentication plugin is 'internal'.
*
@@ -98,45 +79,19 @@ class auth_plugin_ip extends auth_plugin_base {
return false;
}
/**
* Returns true if this authentication plugin can change the user's
* password.
*
* @return bool
*/
function can_change_password() {
return true;
}
/**
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
* @return string
*/
function change_password_url() {
return '';
}
/**
* Returns true if plugin allows resetting of internal password.
*
* @return bool
*/
function can_reset_password() {
return true;
}
/**
* Prints a form for configuring this authentication plugin.
*
* This function is called from admin/auth.php, and outputs a full page with
* a form for configuring this plugin.
*
* @param array $page An object containing all the data for this page.
* @param array $config An object containing all the data for this page.
* @param string $error
* @param array $user_fields
* @return void
*/
function config_form($config, $err, $user_fields) {
include "config.html";
include 'config.html';
}
/**

View File

@@ -27,9 +27,9 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2013072411; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2013051400; // Requires this Moodle version (2.5)
$plugin->version = 2014072522; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2012120300; // Requires this Moodle version (2.4)
$plugin->component = 'auth_ip'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '1.0 Build: 2013101700';
$plugin->release = '1.1 (Build: 2014072522)';