mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-08-29 01:13:08 +00:00
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user