Skip to content

Commit

Permalink
Merge branch 'w13_MDL-26795_21_emailchange' of git://github.com/skoda…
Browse files Browse the repository at this point in the history
…k/moodle
  • Loading branch information
Sam Hemelryk committed Mar 28, 2011
2 parents ce8b66c + c6a074f commit d2c4a97
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
15 changes: 0 additions & 15 deletions auth/email/lang/en/auth_email.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,23 +24,8 @@
*/ */


$string['auth_emaildescription'] = 'Email confirmation is the default authentication method. When the user signs up, choosing their own new username and password, a confirmation email is sent to the user\'s email address. This email contains a secure link to a page where the user can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.'; $string['auth_emaildescription'] = 'Email confirmation is the default authentication method. When the user signs up, choosing their own new username and password, a confirmation email is sent to the user\'s email address. This email contains a secure link to a page where the user can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.';
$string['auth_emailchangecancel'] = 'Cancel email change';
$string['auth_emailchangepending'] = 'Change pending. Open the link sent to you at {$a->preference_newemail}.';
$string['auth_emailnoemail'] = 'Tried to send you an email but failed!'; $string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
$string['auth_emailnoinsert'] = 'Could not add your record to the database!';
$string['auth_emailnowexists'] = 'The email address you tried to assign to your profile has been assigned to someone else since your original request. Your request for change of email address is hereby cancelled, but you may try again with a different address.';
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://recaptcha.net/learnmore.html for more details. <br /><em>PHP cURL extension is required.</em>'; $string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://recaptcha.net/learnmore.html for more details. <br /><em>PHP cURL extension is required.</em>';
$string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element'; $string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
$string['auth_emailsettings'] = 'Settings'; $string['auth_emailsettings'] = 'Settings';
$string['auth_emailupdate'] = 'Email address update';
$string['auth_emailupdatemessage'] = 'Dear {$a->fullname},
You have requested a change of your email address for your user account at {$a->site}. Please open the following URL in your browser in order to confirm this change.
{$a->url}';
$string['auth_emailupdatesuccess'] = 'Email address of user <em>{$a->fullname}</em> was successfully updated to <em>{$a->email}</em>.';
$string['auth_emailupdatetitle'] = 'Confirmation of email update at {$a->site}';
$string['auth_changingemailaddress'] = 'You have requested a change of email address, from {$a->oldemail} to {$a->newemail}. For security reasons, we are sending you an email message at the new address to confirm that it belongs to you. Your email address will be updated as soon as you open the URL sent to you in that message.';
$string['auth_invalidnewemailkey'] = 'Error: if you are trying to confirm a change of email address, you may have made a mistake in copying the URL we sent you by email. Please copy the address and try again.';
$string['auth_outofnewemailupdateattempts'] = 'You have run out of allowed attempts to update your email address. Your update request has been cancelled.';
$string['pluginname'] = 'Email-based self-registration'; $string['pluginname'] = 'Email-based self-registration';
2 changes: 1 addition & 1 deletion auth/ldap/auth.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ function user_signup($user, $notify=true) {
events_trigger('user_created', $user); events_trigger('user_created', $user);


if (! send_confirmation_email($user)) { if (! send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth_email'); print_error('noemail', 'auth_ldap');
} }


if ($notify) { if ($notify) {
Expand Down
1 change: 1 addition & 0 deletions auth/ldap/lang/en/auth_ldap.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
$string['needbcmath'] = 'You need the BCMath extension to use grace logins with Active Directory'; $string['needbcmath'] = 'You need the BCMath extension to use grace logins with Active Directory';
$string['needmbstring'] = 'You need the mbstring extension to change passwords in Active Directory'; $string['needmbstring'] = 'You need the mbstring extension to change passwords in Active Directory';
$string['nodnforusername'] = 'Error in user_update_password(). No DN for: {$a->username}'; $string['nodnforusername'] = 'Error in user_update_password(). No DN for: {$a->username}';
$string['noemail'] = 'Tried to send you an email but failed!';
$string['notcalledfromserver'] = 'Should not be called from the web server!'; $string['notcalledfromserver'] = 'Should not be called from the web server!';
$string['noupdatestobedone'] = "No updates to be done\n"; $string['noupdatestobedone'] = "No updates to be done\n";
$string['nouserentriestoremove'] = "No user entries to be removed\n"; $string['nouserentriestoremove'] = "No user entries to be removed\n";
Expand Down
11 changes: 11 additions & 0 deletions lang/en/auth.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
$string['auth_usernameexists'] = 'Selected username already exists. Please choose a new one.'; $string['auth_usernameexists'] = 'Selected username already exists. Please choose a new one.';
$string['auto_add_remote_users'] = 'Auto add remote users'; $string['auto_add_remote_users'] = 'Auto add remote users';
$string['createpasswordifneeded'] = 'Create password if needed'; $string['createpasswordifneeded'] = 'Create password if needed';
$string['emailchangecancel'] = 'Cancel email change';
$string['emailchangepending'] = 'Change pending. Open the link sent to you at {$a->preference_newemail}.';
$string['emailnowexists'] = 'The email address you tried to assign to your profile has been assigned to someone else since your original request. Your request for change of email address is hereby cancelled, but you may try again with a different address.';
$string['emailupdate'] = 'Email address update';
$string['emailupdatemessage'] = 'Dear {$a->fullname},
You have requested a change of your email address for your user account at {$a->site}. Please open the following URL in your browser in order to confirm this change.
{$a->url}';
$string['emailupdatesuccess'] = 'Email address of user <em>{$a->fullname}</em> was successfully updated to <em>{$a->email}</em>.';
$string['emailupdatetitle'] = 'Confirmation of email update at {$a->site}';
$string['enterthenumbersyouhear'] = 'Enter the numbers you hear'; $string['enterthenumbersyouhear'] = 'Enter the numbers you hear';
$string['enterthewordsabove'] = 'Enter the words above'; $string['enterthewordsabove'] = 'Enter the words above';
$string['errormaxconsecutiveidentchars'] = 'Passwords must have at most {$a} consecutive identical characters.'; $string['errormaxconsecutiveidentchars'] = 'Passwords must have at most {$a} consecutive identical characters.';
Expand Down
6 changes: 3 additions & 3 deletions user/edit.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
$usernew->preference_newemailattemptsleft = 3; $usernew->preference_newemailattemptsleft = 3;
$a->oldemail = $usernew->email = $user->email; $a->oldemail = $usernew->email = $user->email;


$email_changed_html = $OUTPUT->box(get_string('auth_changingemailaddress', 'auth_email', $a), 'generalbox', 'notice'); $email_changed_html = $OUTPUT->box(get_string('auth_changingemailaddress', 'auth', $a), 'generalbox', 'notice');
$email_changed_html .= $OUTPUT->continue_button("$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id"); $email_changed_html .= $OUTPUT->continue_button("$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id");
$email_changed = true; $email_changed = true;
} }
Expand Down Expand Up @@ -225,8 +225,8 @@
$a->site = $SITE->fullname; $a->site = $SITE->fullname;
$a->fullname = fullname($user, true); $a->fullname = fullname($user, true);


$emailupdatemessage = get_string('auth_emailupdatemessage', 'auth_email', $a); $emailupdatemessage = get_string('emailupdatemessage', 'auth', $a);
$emailupdatetitle = get_string('auth_emailupdatetitle', 'auth_email', $a); $emailupdatetitle = get_string('emailupdatetitle', 'auth', $a);


//email confirmation directly rather than using messaging so they will definitely get an email //email confirmation directly rather than using messaging so they will definitely get an email
if (!$mail_results = email_to_user($temp_user, get_admin(), $emailupdatetitle, $emailupdatemessage)) { if (!$mail_results = email_to_user($temp_user, get_admin(), $emailupdatetitle, $emailupdatemessage)) {
Expand Down
4 changes: 2 additions & 2 deletions user/editlib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ function useredit_shared_definition(&$mform, $editoroptions = null) {


// Do not show email field if change confirmation is pending // Do not show email field if change confirmation is pending
if (!empty($CFG->emailchangeconfirmation) and !empty($user->preference_newemail)) { if (!empty($CFG->emailchangeconfirmation) and !empty($user->preference_newemail)) {
$notice = get_string('auth_emailchangepending', 'auth_email', $user); $notice = get_string('emailchangepending', 'auth', $user);
$notice .= '<br /><a href="edit.php?cancelemailchange=1&amp;id='.$user->id.'">' $notice .= '<br /><a href="edit.php?cancelemailchange=1&amp;id='.$user->id.'">'
. get_string('auth_emailchangecancel', 'auth_email') . '</a>'; . get_string('emailchangecancel', 'auth') . '</a>';
$mform->addElement('static', 'emailpending', get_string('email'), $notice); $mform->addElement('static', 'emailpending', get_string('email'), $notice);
} else { } else {
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"'); $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
Expand Down
10 changes: 5 additions & 5 deletions user/emailupdate.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$preferences = get_user_preferences(null, null, $user->id); $preferences = get_user_preferences(null, null, $user->id);
$a = new stdClass(); $a = new stdClass();
$a->fullname = fullname($user, true); $a->fullname = fullname($user, true);
$stremailupdate = get_string('auth_emailupdate', 'auth_email', $a); $stremailupdate = get_string('emailupdate', 'auth', $a);


$PAGE->set_title(format_string($SITE->fullname) . ": $stremailupdate"); $PAGE->set_title(format_string($SITE->fullname) . ": $stremailupdate");
$PAGE->set_heading(format_string($SITE->fullname) . ": $stremailupdate"); $PAGE->set_heading(format_string($SITE->fullname) . ": $stremailupdate");
Expand All @@ -52,7 +52,7 @@


} elseif ($preferences['newemailattemptsleft'] < 1) { } elseif ($preferences['newemailattemptsleft'] < 1) {
cancel_email_update($user->id); cancel_email_update($user->id);
$stroutofattempts = get_string('auth_outofnewemailupdateattempts', 'auth_email'); $stroutofattempts = get_string('auth_outofnewemailupdateattempts', 'auth');
echo $OUTPUT->box($stroutofattempts, 'center'); echo $OUTPUT->box($stroutofattempts, 'center');


} elseif ($key == $preferences['newemailkey']) { } elseif ($key == $preferences['newemailkey']) {
Expand All @@ -62,7 +62,7 @@


// Detect duplicate before saving // Detect duplicate before saving
if ($DB->get_record('user', array('email' => $user->email))) { if ($DB->get_record('user', array('email' => $user->email))) {
$stremailnowexists = get_string('auth_emailnowexists', 'auth_email'); $stremailnowexists = get_string('emailnowexists', 'auth');
echo $OUTPUT->box($stremailnowexists, 'center'); echo $OUTPUT->box($stremailnowexists, 'center');
echo $OUTPUT->continue_button("$CFG->wwwroot/user/view.php?id=$user->id"); echo $OUTPUT->continue_button("$CFG->wwwroot/user/view.php?id=$user->id");
} else { } else {
Expand All @@ -72,15 +72,15 @@
$authplugin->user_update($olduser, $user); $authplugin->user_update($olduser, $user);
events_trigger('user_updated', $user); events_trigger('user_updated', $user);
$a->email = $user->email; $a->email = $user->email;
$stremailupdatesuccess = get_string('auth_emailupdatesuccess', 'auth_email', $a); $stremailupdatesuccess = get_string('emailupdatesuccess', 'auth', $a);
echo $OUTPUT->box($stremailupdatesuccess, 'center'); echo $OUTPUT->box($stremailupdatesuccess, 'center');
echo $OUTPUT->continue_button("$CFG->wwwroot/user/view.php?id=$user->id"); echo $OUTPUT->continue_button("$CFG->wwwroot/user/view.php?id=$user->id");
} }


} else { } else {
$preferences['newemailattemptsleft']--; $preferences['newemailattemptsleft']--;
set_user_preference('newemailattemptsleft', $preferences['newemailattemptsleft'], $user->id); set_user_preference('newemailattemptsleft', $preferences['newemailattemptsleft'], $user->id);
$strinvalidkey = get_string('auth_invalidnewemailkey', 'auth_email'); $strinvalidkey = get_string('auth_invalidnewemailkey', 'auth');
echo $OUTPUT->box($strinvalidkey, 'center'); echo $OUTPUT->box($strinvalidkey, 'center');
} }


Expand Down

0 comments on commit d2c4a97

Please sign in to comment.