mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 07:34:43 +00:00
Fix #10517
This commit is contained in:
@@ -97,6 +97,9 @@ class Authenticate
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($guards as $guard) {
|
foreach ($guards as $guard) {
|
||||||
|
if ('api' !== $guard) {
|
||||||
|
$this->auth->guard($guard)->authenticate();
|
||||||
|
}
|
||||||
$result = $this->auth->guard($guard)->check();
|
$result = $this->auth->guard($guard)->check();
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$user = $this->auth->guard($guard)->user();
|
$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.
|
// at this point we can report its error instead of a generic one.
|
||||||
$message = 'Unauthenticated.';
|
$message = 'Unauthenticated.';
|
||||||
if (Handler::$lastError instanceof OAuthServerException) {
|
if (Handler::$lastError instanceof OAuthServerException) {
|
||||||
|
@@ -25,6 +25,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support\Authentication;
|
namespace FireflyIII\Support\Authentication;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Support\Facades\Preferences;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Contracts\Auth\Authenticatable;
|
use Illuminate\Contracts\Auth\Authenticatable;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
@@ -86,14 +87,14 @@ class RemoteUserGuard implements Guard
|
|||||||
|
|
||||||
if (null !== $header) {
|
if (null !== $header) {
|
||||||
$emailAddress = (string) (request()->server($header) ?? apache_request_headers()[$header] ?? null);
|
$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) {
|
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 the pref isn't null and the object returned isn't null, update the email address.
|
||||||
if ('' !== $emailAddress && null !== $preference && $emailAddress !== $preference->data) {
|
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