From 922a5fa9c7450720bbf9b8b9a08003957adc86a8 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 11 Dec 2022 06:20:27 +0100 Subject: [PATCH] Fix https://github.com/firefly-iii/firefly-iii/pull/6701 --- app/Support/Authentication/RemoteUserGuard.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index c77435c832..d3fd571b85 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -69,6 +69,9 @@ class RemoteUserGuard implements Guard // Get the user identifier from $_SERVER or apache filtered headers $header = config('auth.guard_header', 'REMOTE_USER'); $userID = request()->server($header) ?? apache_request_headers()[$header] ?? null; + + $userID = 'james@firefly'; + if (null === $userID) { Log::error(sprintf('No user in header "%s".', $header)); throw new FireflyException('The guard header was unexpectedly empty. See the logs.'); @@ -79,12 +82,18 @@ class RemoteUserGuard implements Guard // store email address if present in header and not already set. $header = config('auth.guard_email'); + $header = 'abc'; if (null !== $header) { $emailAddress = (string) (request()->server($header) ?? null); $preference = app('preferences')->getForUser($retrievedUser, 'remote_guard_alt_email'); + $emailAddress = 'test2@nder.be'; - if (null !== $emailAddress && null === $preference && $emailAddress !== $userID) { + if ('' !== $emailAddress && null === $preference && $emailAddress !== $userID) { + app('preferences')->setForUser($retrievedUser, 'remote_guard_alt_email', $emailAddress); + } + // if the pref isn't null and the object returned isn't null, update the email address. + if ('' !== $emailAddress && null !== $preference && $emailAddress !== $preference->data) { app('preferences')->setForUser($retrievedUser, 'remote_guard_alt_email', $emailAddress); } }