From 036d7baf27678185640757fd52ec04cad1c64496 Mon Sep 17 00:00:00 2001 From: flashwave Date: Mon, 12 Dec 2016 20:15:58 +0100 Subject: [PATCH] rewrote the e-mails --- app/Controllers/AuthController.php | 47 ++++++++---------------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php index 0cc343b..9aa9905 100644 --- a/app/Controllers/AuthController.php +++ b/app/Controllers/AuthController.php @@ -321,32 +321,18 @@ class AuthController extends Controller */ private function sendActivationMail(User $user): void { - // Generate activation key $activate = ActionCode::generate('ACTIVATE', $user->id); - $siteName = config('general.name'); $baseUrl = "http://{$_SERVER['HTTP_HOST']}"; $activateLink = route('auth.activate') . "?u={$user->id}&k={$activate}"; - $profileLink = route('user.profile', $user->id); $signature = config('mail.signature'); - // Build the e-mail - $message = "Welcome to {$siteName}!\r\n\r\n" - . "Please keep this e-mail for your records. Your account intormation is as follows:\r\n\r\n" - . "----------------------------\r\n\r\n" - . "Username: {$user->username}\r\n\r\n" - . "Your profile: {$baseUrl}{$profileLink}\r\n\r\n" - . "----------------------------\r\n\r\n" - . "Please visit the following link in order to activate your account:\r\n\r\n" + $message = "Hey {$user->username}, welcome to {$siteName}!\r\n\r\n" + . "Your account is almost ready, the only thing left to do is for you to click the following link:\r\n" . "{$baseUrl}{$activateLink}\r\n\r\n" - . "Your password has been securely stored in our database and cannot be retrieved. " - . "In the event that it is forgotten," - . " you will be able to reset it using the email address associated with your account.\r\n\r\n" - . "Thank you for registering.\r\n\r\n" - . "--\r\n\r\nThanks\r\n\r\n{$signature}"; + . "Hope to see you around,\r\n{$signature}"; - // Send the message - send_mail([$user->email => $user->username], "{$siteName} activation mail", $message); + send_mail([$user->email => $user->username], "Welcome to {$siteName}!", $message); } /** @@ -355,29 +341,20 @@ class AuthController extends Controller */ private function sendPasswordMail(User $user): void { - // Generate the verification key $verk = ActionCode::generate('LOST_PASS', $user->id); - $siteName = config('general.name'); $baseUrl = "http://{$_SERVER['HTTP_HOST']}"; - $reactivateLink = route('auth.resetpassword') . "?u={$user->id}&k={$verk}"; + $pass_confirm = route('auth.resetpassword') . "?u={$user->id}&k={$verk}"; $signature = config('mail.signature'); - // Build the e-mail - $message = "Hello {$user->username},\r\n\r\n" - . "You are receiving this notification because you have (or someone pretending to be you has)" - . " requested a password reset link to be sent for your account on \"{$siteName}\"." - . " If you did not request this notification then please ignore it," - . " if you keep receiving it please contact the site administrator.\r\n\r\n" - . "To use this password reset key you need to go to a special page." - . " To do this click the link provided below.\r\n\r\n" - . "{$baseUrl}{$reactivateLink}\r\n\r\n" - . "If successful you should be able to change your password here.\r\n\r\n" - . "You can of course change this password yourself via the settings page." - . " If you have any difficulties please contact the site administrator.\r\n\r\n" - . "--\r\n\r\nThanks\r\n\r\n{$signature}"; + $message = "Hey {$user->username},\r\n\r\n" + . "You, or someone pretending to be you, requested a password change for your account!\r\n" + . "Click the following link to confirm the password change:\r\n" + . "{$baseUrl}{$pass_confirm}\r\n\r\n" + . "If this wasn't you please just ignore this e-mail, unless this isn't the first" + . " time this has happened in which case you should contact a staff member.\r\n\r\n" + . "--\r\n{$signature}"; - // Send the message send_mail([$user->email => $user->username], "{$siteName} password restoration", $message); } }