MDL-55923 webservice: Add global setting for forcing token deletion

This commit is contained in:
Juan Leyva 2016-09-28 12:04:01 +01:00
parent ddd8dc0d1b
commit 6a09295857
4 changed files with 12 additions and 3 deletions

View File

@ -96,6 +96,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('passwordchangelogout',
new lang_string('passwordchangelogout', 'admin'),
new lang_string('passwordchangelogout_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('passwordchangetokendeletion',
new lang_string('passwordchangetokendeletion', 'admin'),
new lang_string('passwordchangetokendeletion_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', new lang_string('groupenrolmentkeypolicy', 'admin'), new lang_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('disableuserimages', new lang_string('disableuserimages', 'admin'), new lang_string('configdisableuserimages', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));

View File

@ -780,6 +780,8 @@ $string['order3'] = 'Third';
$string['order4'] = 'Fourth';
$string['passwordchangelogout'] = 'Log out after password change';
$string['passwordchangelogout_desc'] = 'If enabled, when a password is changed, all browser sessions are terminated, apart from the one in which the new password is specified. (This setting does not affect password changes via bulk user upload.)';
$string['passwordchangetokendeletion'] = 'Remove web service access tokens after password change';
$string['passwordchangetokendeletion_desc'] = 'If enabled, when a password is changed, all the user web service access tokens are deleted.';
$string['passwordpolicy'] = 'Password policy';
$string['passwordresettime'] = 'Maximum time to validate password reset request';
$string['passwordreuselimit'] = 'Password rotation limit';

View File

@ -4570,8 +4570,10 @@ function update_internal_user_password($user, $password, $fasthash = false) {
\core\event\user_password_updated::create_from_user($user)->trigger();
// Remove WS user tokens.
require_once($CFG->dirroot.'/webservice/lib.php');
webservice::delete_user_ws_tokens($user->id);
if (!empty($CFG->passwordchangetokendeletion)) {
require_once($CFG->dirroot.'/webservice/lib.php');
webservice::delete_user_ws_tokens($user->id);
}
}
return true;

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2016092900.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2016092900.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.