Merge branch 'MDL-59298-master' of git://github.com/rezaies/moodle
This commit is contained in:
+4
-24
@@ -6431,17 +6431,14 @@ function send_password_change_confirmation_email($user, $resetrecord) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an email containinginformation on how to change your password.
|
||||
* Sends an email containing information on how to change your password.
|
||||
*
|
||||
* @param stdClass $user A {@link $USER} object
|
||||
* @return bool Returns true if mail was sent OK and false if there was an error.
|
||||
*/
|
||||
function send_password_change_info($user) {
|
||||
global $CFG;
|
||||
|
||||
$site = get_site();
|
||||
$supportuser = core_user::get_support_user();
|
||||
$systemcontext = context_system::instance();
|
||||
|
||||
$data = new stdClass();
|
||||
$data->firstname = $user->firstname;
|
||||
@@ -6450,35 +6447,18 @@ function send_password_change_info($user) {
|
||||
$data->sitename = format_string($site->fullname);
|
||||
$data->admin = generate_email_signoff();
|
||||
|
||||
$userauth = get_auth_plugin($user->auth);
|
||||
|
||||
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.
|
||||
return email_to_user($user, $supportuser, $subject, $message);
|
||||
}
|
||||
|
||||
if ($userauth->can_change_password() and $userauth->change_password_url()) {
|
||||
// We have some external url for password changing.
|
||||
$data->link .= $userauth->change_password_url();
|
||||
|
||||
} else {
|
||||
// No way to change password, sorry.
|
||||
$data->link = '';
|
||||
}
|
||||
|
||||
if (!empty($data->link) and has_capability('moodle/user:changeownpassword', $systemcontext, $user->id)) {
|
||||
$message = get_string('emailpasswordchangeinfo', '', $data);
|
||||
$subject = get_string('emailpasswordchangeinfosubject', '', format_string($site->fullname));
|
||||
} else {
|
||||
$message = get_string('emailpasswordchangeinfofail', '', $data);
|
||||
$subject = get_string('emailpasswordchangeinfosubject', '', format_string($site->fullname));
|
||||
}
|
||||
$userauth = get_auth_plugin($user->auth);
|
||||
['subject' => $subject, 'message' => $message] = $userauth->get_password_change_info($user);
|
||||
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
return email_to_user($user, $supportuser, $subject, $message);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user