MDL-36721 do not store passwords in config logs

This commit is contained in:
Petr Škoda
2013-12-27 11:17:45 +08:00
committed by Petr Škoda
parent bbb291b7b7
commit 914499a340
4 changed files with 167 additions and 2 deletions
+27 -1
View File
@@ -1660,11 +1660,21 @@ abstract class admin_setting {
rebuild_course_cache(0, true);
}
add_to_config_log($name, $oldvalue, $value, $this->plugin);
$this->add_to_config_log($name, $oldvalue, $value);
return true; // BC only
}
/**
* Log config changes if necessary.
* @param string $name
* @param string $oldvalue
* @param string $value
*/
protected function add_to_config_log($name, $oldvalue, $value) {
add_to_config_log($name, $oldvalue, $value, $this->plugin);
}
/**
* Returns current value of this setting
* @return mixed array or string depending on instance, NULL means not set yet
@@ -2161,6 +2171,22 @@ class admin_setting_configpasswordunmask extends admin_setting_configtext {
parent::__construct($name, $visiblename, $description, $defaultsetting, PARAM_RAW, 30);
}
/**
* Log config changes if necessary.
* @param string $name
* @param string $oldvalue
* @param string $value
*/
protected function add_to_config_log($name, $oldvalue, $value) {
if ($value !== '') {
$value = '********';
}
if ($oldvalue !== '' and $oldvalue !== null) {
$oldvalue = '********';
}
parent::add_to_config_log($name, $oldvalue, $value);
}
/**
* Returns XHTML for the field
* Writes Javascript into the HTML below right before the last div