mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-59298 auth_nologin: override get_password_change_info
Let the auth_nologin class to take care of its exceptional behaviour.
This commit is contained in:
parent
206ec32890
commit
4c00766e2a
@ -103,6 +103,33 @@ class auth_plugin_nologin extends auth_plugin_base {
|
||||
function can_be_manually_set() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns information on how the specified user can change their password.
|
||||
* User accounts with authentication type set to nologin are disabled accounts.
|
||||
* They cannot change their password.
|
||||
*
|
||||
* @param stdClass $user A user object
|
||||
* @return string[] An array of strings with keys subject and message
|
||||
*/
|
||||
public function get_password_change_info(stdClass $user) : array {
|
||||
$site = get_site();
|
||||
|
||||
$data = new stdClass();
|
||||
$data->firstname = $user->firstname;
|
||||
$data->lastname = $user->lastname;
|
||||
$data->username = $user->username;
|
||||
$data->sitename = format_string($site->fullname);
|
||||
$data->admin = generate_email_signoff();
|
||||
|
||||
$message = get_string('emailpasswordchangeinfodisabled', '', $data);
|
||||
$subject = get_string('emailpasswordchangeinfosubject', '', format_string($site->fullname));
|
||||
|
||||
return [
|
||||
'subject' => $subject,
|
||||
'message' => $message
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -6422,7 +6422,7 @@ function send_password_change_info($user) {
|
||||
$data->sitename = format_string($site->fullname);
|
||||
$data->admin = generate_email_signoff();
|
||||
|
||||
if (!is_enabled_auth($user->auth) or $user->auth == 'nologin') {
|
||||
if (!is_enabled_auth($user->auth)) {
|
||||
$message = get_string('emailpasswordchangeinfodisabled', '', $data);
|
||||
$subject = get_string('emailpasswordchangeinfosubject', '', format_string($site->fullname));
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
|
Loading…
x
Reference in New Issue
Block a user