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

This commit is contained in:
Juan Leyva
2015-03-02 14:39:52 +00:00
committed by Dan Poltawski
parent b771b31e20
commit bd3b68c8a7
+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);