MDL-42097 auth: Auth plugins must check passwordurl before returning it

This commit is contained in:
Ankit Agarwal
2013-12-03 14:17:42 +08:00
parent 6513cc0376
commit 963cdce4e2
6 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -664,7 +664,7 @@ class auth_plugin_db extends auth_plugin_base {
* @return moodle_url
*/
function change_password_url() {
if ($this->is_internal()) {
if ($this->is_internal() || empty($this->config->changepasswordurl)) {
// Standard form.
return null;
} else {
+5 -1
View File
@@ -120,7 +120,11 @@ class auth_plugin_imap extends auth_plugin_base {
* @return moodle_url
*/
function change_password_url() {
return new moodle_url($this->config->changepasswordurl);
if (!empty($this->config->changepasswordurl)) {
return new moodle_url($this->config->changepasswordurl);
} else {
return null;
}
}
/**
+5 -1
View File
@@ -1603,7 +1603,11 @@ class auth_plugin_ldap extends auth_plugin_base {
*/
function change_password_url() {
if (empty($this->config->stdchangepassword)) {
return new moodle_url($this->config->changepasswordurl);
if (!empty($this->config->changepasswordurl)) {
return new moodle_url($this->config->changepasswordurl);
} else {
return null;
}
} else {
return null;
}
+5 -1
View File
@@ -120,7 +120,11 @@ class auth_plugin_pop3 extends auth_plugin_base {
* @return moodle_url
*/
function change_password_url() {
return new moodle_url($this->config->changepasswordurl);
if (!empty($this->config->changepasswordurl)) {
return new moodle_url($this->config->changepasswordurl);
} else {
return null;
}
}
/**
+4
View File
@@ -1,6 +1,10 @@
This files describes API changes in /auth/* - plugins,
information provided here is intended especially for developers.
=== 2.7 ===
* If you are returning a url in method change_password_url() from config, please make sure it is set before trying to use it.
=== 2.6 ===
* can_be_manually_set() - This function was introduced in the base class and returns false by default. If overriden by
+2
View File
@@ -159,6 +159,8 @@ class auth_plugin_base {
*
* This method is used if can_change_password() returns true.
* This method is called only when user is logged in, it may use global $USER.
* If you are using a plugin config variable in this method, please make sure it is set before using it,
* as this method can be called even if the plugin is disabled, in which case the config values won't be set.
*
* @return moodle_url url of the profile page or null if standard used
*/