MDL-48691 webservices: Check if the user must be changing password

This commit is contained in:
Juan Leyva
2015-01-29 16:56:20 +01:00
committed by Dan Poltawski
parent 1a344ea46f
commit b0abcbda17
+9
View File
@@ -64,6 +64,15 @@ if (!empty($user)) {
}
}
// Check whether the user should be changing password.
if (get_user_preferences('auth_forcepasswordchange', false, $user)) {
if ($userauth->can_change_password()) {
throw new moodle_exception('forcepasswordchangenotice');
} else {
throw new moodle_exception('nopasswordchangeforced', 'auth');
}
}
// let enrol plugins deal with new enrolments if necessary
enrol_check_plugins($user);