mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Make email messages Markdown.
This commit is contained in:
@@ -59,18 +59,16 @@ class APIEventHandler
|
||||
$email = config('firefly.site_owner');
|
||||
}
|
||||
|
||||
$ipAddress = Request::ip();
|
||||
|
||||
// see if user has alternative email address:
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email');
|
||||
if (null !== $pref) {
|
||||
$email = (string)(is_array($pref->data) ? $email : $pref->data);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Now in APIEventHandler::accessTokenCreated. Email is %s, IP is %s', $email, $ipAddress));
|
||||
Log::debug(sprintf('Now in APIEventHandler::accessTokenCreated. Email is %s', $email));
|
||||
try {
|
||||
Log::debug('Trying to send message...');
|
||||
Mail::to($email)->send(new AccessTokenCreatedMail($email, $ipAddress));
|
||||
Mail::to($email)->send(new AccessTokenCreatedMail);
|
||||
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::debug('Send message failed! :(');
|
||||
|
||||
@@ -52,7 +52,6 @@ class AdminEventHandler
|
||||
// is user even admin?
|
||||
if ($repository->hasRole($event->user, 'owner')) {
|
||||
$email = $event->user->email;
|
||||
$ipAddress = $event->ipAddress;
|
||||
|
||||
// if user is demo user, send to owner:
|
||||
if ($event->user->hasRole('demo')) {
|
||||
@@ -65,10 +64,10 @@ class AdminEventHandler
|
||||
$email = $pref->data;
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Now in sendTestMessage event handler. Email is %s, IP is %s', $email, $ipAddress));
|
||||
Log::debug(sprintf('Now in sendTestMessage event handler. Email is %s', $email));
|
||||
try {
|
||||
Log::debug('Trying to send message...');
|
||||
Mail::to($email)->send(new AdminTestMail($email, $ipAddress));
|
||||
Mail::to($email)->send(new AdminTestMail($email));
|
||||
|
||||
// Laravel cannot pretend this process failed during testing.
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
|
||||
@@ -58,23 +58,9 @@ class AutomationHandler
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$user = $repository->find($event->userId);
|
||||
if (null !== $user && 0 !== $event->groups->count()) {
|
||||
|
||||
$email = $user->email;
|
||||
|
||||
// see if user has alternative email address:
|
||||
$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email');
|
||||
if (null !== $pref) {
|
||||
$email = $pref->data;
|
||||
}
|
||||
|
||||
// if user is demo user, send to owner:
|
||||
if ($user->hasRole('demo')) {
|
||||
$email = config('firefly.site_owner');
|
||||
}
|
||||
|
||||
try {
|
||||
Log::debug('Trying to mail...');
|
||||
Mail::to($user->email)->send(new ReportNewJournalsMail($email, '127.0.0.1', $event->groups));
|
||||
Mail::to($user->email)->send(new ReportNewJournalsMail($event->groups));
|
||||
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::debug('Send message failed! :(');
|
||||
|
||||
@@ -229,11 +229,10 @@ class UserEventHandler
|
||||
$newEmail = $event->newEmail;
|
||||
$oldEmail = $event->oldEmail;
|
||||
$user = $event->user;
|
||||
$ipAddress = $event->ipAddress;
|
||||
$token = app('preferences')->getForUser($user, 'email_change_confirm_token', 'invalid');
|
||||
$uri = route('profile.confirm-email-change', [$token->data]);
|
||||
try {
|
||||
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
||||
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri));
|
||||
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::error($e->getMessage());
|
||||
@@ -255,12 +254,11 @@ class UserEventHandler
|
||||
$newEmail = $event->newEmail;
|
||||
$oldEmail = $event->oldEmail;
|
||||
$user = $event->user;
|
||||
$ipAddress = $event->ipAddress;
|
||||
$token = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid');
|
||||
$hashed = hash('sha256', sprintf('%s%s', (string)config('app.key'), $oldEmail));
|
||||
$uri = route('profile.undo-email-change', [$token->data, $hashed]);
|
||||
try {
|
||||
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
||||
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri));
|
||||
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::error($e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user