Commit a5c90219 authored by Hugh Davenport's avatar Hugh Davenport
Browse files

Email user with username when leaving external auth



When a user leaves an institution with an external auth, and
they *have* set a password for internal auth in the distant
past, they may have forgotten their username and/or their password

We can't send them their password in cleartext, as we don't have
a clear version of it, but we can send an email stating how they could
reset their password if nessecary.

Change-Id: Ibef1738832cc4c5214a232f5f3d1f8d3fd6c72a8
Signed-off-by: default avatarHugh Davenport <hugh@catalyst.net.nz>
parent c20c4cc3
......@@ -444,6 +444,41 @@ $string['noinstitutionsetpassemailmessagehtml'] = '<p>Dear %s,</p>
<p>Regards, %s Site Administrator</p>
<p><a href="%sforgotpass.php?key=%s">%sforgotpass.php?key=%s</a></p>';
// Send information about username and how to reset password
// when moving from external to internal auth with a password already set
$string['noinstitutionoldpassemailsubject'] = '%s: Membership of %s';
$string['noinstitutionoldpassemailmessagetext'] = 'Dear %s,
You are no longer a member of %s.
You may continue to use %s with your current username %s, and the password that you have already set for your account.
If you have forgotten your password, you can reset it by going to the following page and entering in your username.
%sforgotpass.php
If you have any questions regarding the above, please feel free to contact
us.
%scontact.php
Regards, %s Site Administrator
%sforgotpass.php';
$string['noinstitutionoldpassemailmessagehtml'] = '<p>Dear %s,</p>
<p>You are no longer a member of %s.</p>
<p>You may continue to use %s with your current username %s, and the password that you have already set for your account.</p>
<p>If you have forgotten your password, you can reset it by going to the following page and entering in your username.</p>
<p><a href="%sforgotpass.php">%sforgotpass.php</a></p>
<p>If you have any questions regarding the above, please feel free to <a href="%scontact.php">contact us</a>.</p>
<p>Regards, %s Site Administrator</p>
<p><a href="%sforgotpass.php">%sforgotpass.php</a></p>';
$string['debugemail'] = 'NOTICE: This e-mail was intended for %s <%s> but has been sent to you as per the "sendallemailto" configuration setting.';
$string['divertingemailto'] = 'Diverting email to %s';
......
......@@ -422,6 +422,14 @@ class Institution {
log_debug('resetting pw for '.$user->id);
$this->removeMemberSetPassword($user);
}
else if ($authinstances[$oldauth]->authname != 'internal') {
$sitename = get_config('sitename');
$fullname = display_name($user, null, true);
email_user($user, null,
get_string('noinstitutionoldpassemailsubject', 'mahara', $sitename, $this->displayname),
get_string('noinstitutionoldpassemailmessagetext', 'mahara', $fullname, $this->displayname, $sitename, $user->username, get_config('wwwroot'), get_config('wwwroot'), $sitename, get_config('wwwroot')),
get_string('noinstitutionoldpassemailmessagehtml', 'mahara', hsc($fullname), hsc($this->displayname), hsc($sitename), hsc($user->username), get_config('wwwroot'), get_config('wwwroot'), get_config('wwwroot'), hsc($sitename), get_config('wwwroot'), get_config('wwwroot')));
}
update_record('usr', $user);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment