Merge branch 'develop' into 5.8-dev

# Conflicts:
#	app/Factory/TransactionJournalFactory.php
#	app/Providers/EventServiceProvider.php
#	app/Repositories/PiggyBank/ModifiesPiggyBanks.php
#	app/Support/Search/OperatorQuerySearch.php
#	app/Support/Steam.php
#	app/TransactionRules/Actions/UpdatePiggybank.php
#	composer.json
#	composer.lock
#	config/search.php
#	frontend/yarn.lock
#	resources/lang/en_US/firefly.php
This commit is contained in:
James Cole
2022-12-11 07:37:33 +01:00
30 changed files with 802 additions and 640 deletions

View File

@@ -68,6 +68,7 @@ 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;
if (null === $userID) {
Log::error(sprintf('No user in header "%s".', $header));
throw new FireflyException('The guard header was unexpectedly empty. See the logs.');
@@ -80,10 +81,14 @@ class RemoteUserGuard implements Guard
$header = config('auth.guard_email');
if (null !== $header) {
$emailAddress = (string) (request()->server($header) ?? null);
$emailAddress = (string) (request()->server($header) ?? apache_request_headers()[$header] ?? null);
$preference = app('preferences')->getForUser($retrievedUser, 'remote_guard_alt_email');
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);
}
}