Send messages to owner, not to user when user is demo.

This commit is contained in:
James Cole
2020-11-03 20:33:46 +01:00
parent 433397cb3d
commit 80ef6fcb04
3 changed files with 15 additions and 0 deletions

View File

@@ -52,6 +52,12 @@ class APIEventHandler
$user = $repository->findNull((int) $event->userId);
if (null !== $user) {
$email = $user->email;
// if user is demo user, send to owner:
if($user->hasRole('demo')) {
$email = config('firefly.site_owner');
}
$ipAddress = Request::ip();
// see if user has alternative email address:

View File

@@ -52,6 +52,11 @@ class AdminEventHandler
$email = $event->user->email;
$ipAddress = $event->ipAddress;
// if user is demo user, send to owner:
if($event->user->hasRole('demo')) {
$email = config('firefly.site_owner');
}
// see if user has alternative email address:
$pref = app('preferences')->getForUser($event->user, 'remote_guard_alt_email', null);
if (null !== $pref) {

View File

@@ -65,6 +65,10 @@ class AutomationHandler
$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...');