From a528f9ca2e911a84aaff7cc12c984618ef757225 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 20 Oct 2025 17:47:35 +0800 Subject: [PATCH] MDL-86905 core: Use proper link markup for email links --- auth/oauth2/classes/api.php | 8 ++--- auth/oauth2/lang/en/auth_oauth2.php | 23 ++++--------- lang/en/admin.php | 10 ++---- lang/en/auth.php | 10 ++++-- lang/en/moodle.php | 53 +++++++++++------------------ 5 files changed, 39 insertions(+), 65 deletions(-) diff --git a/auth/oauth2/classes/api.php b/auth/oauth2/classes/api.php index 5bf053cfcf5..8856c97708d 100644 --- a/auth/oauth2/classes/api.php +++ b/auth/oauth2/classes/api.php @@ -197,9 +197,7 @@ class api { $data->link = $confirmationurl->out(false); $message = get_string('confirmlinkedloginemail', 'auth_oauth2', $data); - - $data->link = $confirmationurl->out(); - $messagehtml = text_to_html(get_string('confirmlinkedloginemail', 'auth_oauth2', $data), false, false, true); + $messagehtml = text_to_html(get_string('confirmlinkedloginemail', 'auth_oauth2', $data), false, false); $user->mailformat = 1; // Always send HTML version as well. @@ -339,9 +337,7 @@ class api { $data->link = $confirmationurl->out(false); $message = get_string('confirmaccountemail', 'auth_oauth2', $data); - - $data->link = $confirmationurl->out(); - $messagehtml = text_to_html(get_string('confirmaccountemail', 'auth_oauth2', $data), false, false, true); + $messagehtml = text_to_html(get_string('confirmaccountemail', 'auth_oauth2', $data), false, false); $user->mailformat = 1; // Always send HTML version as well. diff --git a/auth/oauth2/lang/en/auth_oauth2.php b/auth/oauth2/lang/en/auth_oauth2.php index 166cea78df4..4e942ac1e2b 100644 --- a/auth/oauth2/lang/en/auth_oauth2.php +++ b/auth/oauth2/lang/en/auth_oauth2.php @@ -27,19 +27,14 @@ $string['auth_oauth2description'] = 'OAuth 2 standards based authentication'; $string['auth_oauth2settings'] = 'OAuth 2 authentication settings.'; $string['confirmaccountemail'] = 'Hi {$a->firstname}, -A new account has been requested at \'{$a->sitename}\' -using your email address. +A new account has been requested at \'{$a->sitename}\' using your email address. -To confirm your new account, please go to this web address: +To confirm your new account, please click the link below: -{$a->link} +Confirm your account -In most mail programs, this should appear as a blue link -which you can just click on. If that doesn\'t work, -then cut and paste the address into the address -line at the top of your web browser window. -If you need help, please contact the site administrator, +If you need help, please contact the site administrator. {$a->admin} If you did not do this, someone else could be trying to compromise your account. @@ -53,16 +48,12 @@ A request has been made to link the {$a->issuername} login {$a->linkedemail} to your account at \'{$a->sitename}\' using your email address. -To confirm this request and link these logins, please go to this web address: +To confirm this request and link these logins, please click the link below: -{$a->link} +Link your accounts -In most mail programs, this should appear as a blue link -which you can just click on. If that doesn\'t work, -then cut and paste the address into the address -line at the top of your web browser window. -If you need help, please contact the site administrator, +If you need help, please contact the site administrator. {$a->admin} If you did not do this, someone else could be trying to compromise your account. diff --git a/lang/en/admin.php b/lang/en/admin.php index 2aaadcd58bf..9b7cbb13107 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -825,16 +825,12 @@ $string['lockoutemailbody'] = 'Hi {$a->firstname}, Your account with username {$a->username} on server \'{$a->sitename}\' was locked out after multiple invalid login attempts. -To unlock the account immediately go to the following address +To unlock the account immediately, please click the link below: -{$a->link} +Unlock account -In most mail programs, this should appear as a blue link -which you can just click on. If that doesn\'t work, -then copy and paste the address into the address -line at the top of your web browser window. -If you need help, please contact the site administrator, +If you need help, please contact the site administrator. {$a->admin}'; $string['lockoutemailsubject'] = 'Your account on {$a} was locked out'; $string['lockouterrorunlock'] = 'Invalid account unlock information supplied.'; diff --git a/lang/en/auth.php b/lang/en/auth.php index f5963af4f54..3431e01795d 100644 --- a/lang/en/auth.php +++ b/lang/en/auth.php @@ -79,10 +79,14 @@ $string['emailnowexists'] = 'The email address you tried to assign to your profi $string['emailupdate'] = 'Email address update'; $string['emailupdatemessage'] = 'Hi {$a->firstname}, -You have requested a change of your email address for your account on {$a->site}. To confirm this change, please go to the following web address: +You have requested a change of your email address for your account on {$a->site}. -{$a->url} -The confirmation link will expire in 10 minutes. +To confirm this change, please click the link below: + +Confirm email change + + +The confirmation link will expire in 10 minutes. {$a->supportemail}'; $string['emailupdatesuccess'] = 'Email address of user {$a->fullname} was successfully updated to {$a->email}.'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 26564594241..d2d885c62f7 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -649,17 +649,12 @@ $string['emailagain'] = 'Email (again)'; $string['emailconfirm'] = 'Confirm your account'; $string['emailconfirmation'] = 'Hi {$a->firstname}, -A new account has been requested at \'{$a->sitename}\' -using your email address. +A new account has been requested at \'{$a->sitename}\' using your email address. -To confirm your new account, please go to this web address: +To confirm your new account, please click the link below: -{$a->link} +Confirm your account -In most mail programs, this should appear as a blue link -which you can just click on. If that doesn\'t work, -then cut and paste the address into the address -line at the top of your web browser window. If you need help, please contact the site administrator, {$a->admin}'; @@ -706,20 +701,14 @@ $string['emailnotfound'] = 'The email address was not found in the database'; $string['emailonlyallowed'] = 'This email cannot be used. Allowed email domains are: {$a}.'; $string['emailpasswordconfirmation'] = 'Hi {$a->firstname}, -Someone (probably you) has requested a new password for your -account on \'{$a->sitename}\'. +Someone (probably you) has requested a new password for your account on \'{$a->sitename}\'. -To confirm this and have a new password sent to you via email, -go to the following web address: +To confirm this and have a new password sent to you via email, please click the link below: -{$a->link} +Get a new password -In most mail programs, this should appear as a blue link -which you can just click on. If that doesn\'t work, -then cut and paste the address into the address -line at the top of your web browser window. -If you need help, please contact the site administrator, +If you need help, please contact the site administrator. {$a->admin}'; $string['emailpasswordconfirmationsubject'] = '{$a}: Change password confirmation'; $string['emailpasswordconfirmmaybesent'] = '

If you supplied a correct username or unique email address then an email should have been sent to you.

@@ -735,19 +724,14 @@ $string['emailpasswordconfirmsent'] = 'An email should have been sent to your ad If you continue to have difficulty, contact the site administrator.'; $string['emailpasswordchangeinfo'] = 'Hi {$a->firstname}, -Someone (probably you) has requested a new password for your -account \'{$a->username}\' on \'{$a->sitename}\'. +Someone (probably you) has requested a new password for your account \'{$a->username}\' on \'{$a->sitename}\'. -To change your password, please go to the following web address: +To change your password, please click the link below: -{$a->link} +Change password -In most mail programs, this should appear as a blue link -which you can just click on. If that doesn\'t work, -then cut and paste the address into the address -line at the top of your web browser window. -If you need help, please contact the site administrator, +If you need help, please contact the site administrator. {$a->admin}'; $string['emailpasswordchangeinfodisabled'] = 'Hi {$a->firstname}, @@ -764,14 +748,17 @@ $string['emailresetconfirmation'] = 'Hi {$a->firstname}, A password reset was requested for your account \'{$a->username}\' at {$a->sitename}. -To confirm this request, and set a new password for your account, please go to the following web address: -{$a->link} +To confirm this request, and set a new password for your account, please click the link below: + +Reset password + (This link is valid for {$a->resetminutes} minutes from the time this reset was first requested.) If this password reset was not requested by you, no action is needed. -If you need help, please contact the site administrator, {$a->admin}'; +If you need help, please contact the site administrator. +{$a->admin}'; $string['emailresetconfirmationsubject'] = '{$a}: Password reset request'; $string['emailresetconfirmsent'] = 'An email has been sent to your address at {$a}.
It contains easy instructions to confirm and complete this password change. @@ -1513,10 +1500,10 @@ An account has been created for you at \'{$a->sitename}\'. (You will be prompted to change your password when you log in for the first time.) -To start using \'{$a->sitename}\', log in at - {$a->link} -If you need help, contact the site administrator, +Click to log in and start using \'{$a->sitename}\'. + +If you need help, contact the site administrator. {$a->signoff}'; $string['newusers'] = 'New users'; $string['newwindow'] = 'New window';