rewrote the e-mails

This commit is contained in:
flash 2016-12-12 20:15:58 +01:00
parent 8b662ba0eb
commit 036d7baf27

View file

@ -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);
}
}