mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-11 23:28:54 +00:00
Fix #10517
This commit is contained in:
@@ -97,6 +97,9 @@ class Authenticate
|
||||
}
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if ('api' !== $guard) {
|
||||
$this->auth->guard($guard)->authenticate();
|
||||
}
|
||||
$result = $this->auth->guard($guard)->check();
|
||||
if ($result) {
|
||||
$user = $this->auth->guard($guard)->user();
|
||||
@@ -107,7 +110,7 @@ class Authenticate
|
||||
}
|
||||
}
|
||||
|
||||
// this is a massive hack, but if the hander has the oauth exception
|
||||
// this is a massive hack, but if the handler has the oauth exception
|
||||
// at this point we can report its error instead of a generic one.
|
||||
$message = 'Unauthenticated.';
|
||||
if (Handler::$lastError instanceof OAuthServerException) {
|
||||
|
@@ -25,6 +25,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Authentication;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
@@ -86,14 +87,14 @@ class RemoteUserGuard implements Guard
|
||||
|
||||
if (null !== $header) {
|
||||
$emailAddress = (string) (request()->server($header) ?? apache_request_headers()[$header] ?? null);
|
||||
$preference = app('preferences')->getForUser($retrievedUser, 'remote_guard_alt_email');
|
||||
$preference = Preferences::getForUser($retrievedUser, 'remote_guard_alt_email');
|
||||
|
||||
if ('' !== $emailAddress && null === $preference && $emailAddress !== $userID) {
|
||||
app('preferences')->setForUser($retrievedUser, 'remote_guard_alt_email', $emailAddress);
|
||||
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);
|
||||
Preferences::setForUser($retrievedUser, 'remote_guard_alt_email', $emailAddress);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user