Skip to content

Firefly III: a personal finances manager

Fix https://github.com/firefly-iii/firefly-iii/pull/6701

James Cole922a5fa9c745
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 = '[email protected]';
- 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);
}
}