mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 12:28:46 +00:00
Fix code quality with rector [skip ci]
This commit is contained in:
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Middleware;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Closure;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Exceptions\Handler;
|
||||
@@ -126,22 +127,20 @@ class Authenticate
|
||||
private function validateBlockedUser(?User $user, array $guards): void
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
app('log')->warning('User is null, throw exception?');
|
||||
Log::warning('User is null, throw exception?');
|
||||
}
|
||||
if ($user instanceof User) {
|
||||
// app('log')->debug(get_class($user));
|
||||
if (1 === (int) $user->blocked) {
|
||||
$message = (string) trans('firefly.block_account_logout');
|
||||
if ('email_changed' === $user->blocked_code) {
|
||||
$message = (string) trans('firefly.email_changed_logout');
|
||||
}
|
||||
app('log')->warning('User is blocked, cannot use authentication method.');
|
||||
app('session')->flash('logoutMessage', $message);
|
||||
// @noinspection PhpUndefinedMethodInspection
|
||||
$this->auth->logout(); // @phpstan-ignore-line (thinks function is undefined)
|
||||
|
||||
throw new AuthenticationException('Blocked account.', $guards);
|
||||
// \Illuminate\Support\Facades\Log::debug(get_class($user));
|
||||
if ($user instanceof User && 1 === (int) $user->blocked) {
|
||||
$message = (string) trans('firefly.block_account_logout');
|
||||
if ('email_changed' === $user->blocked_code) {
|
||||
$message = (string) trans('firefly.email_changed_logout');
|
||||
}
|
||||
Log::warning('User is blocked, cannot use authentication method.');
|
||||
app('session')->flash('logoutMessage', $message);
|
||||
// @noinspection PhpUndefinedMethodInspection
|
||||
$this->auth->logout();
|
||||
// @phpstan-ignore-line (thinks function is undefined)
|
||||
throw new AuthenticationException('Blocked account.', $guards);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,27 +34,20 @@ use Illuminate\Routing\Route;
|
||||
*/
|
||||
class Binder
|
||||
{
|
||||
/**
|
||||
* The authentication factory instance.
|
||||
*
|
||||
* @var Auth
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* The binders.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $binders = [];
|
||||
protected array $binders;
|
||||
|
||||
/**
|
||||
* Binder constructor.
|
||||
*/
|
||||
public function __construct(Auth $auth)
|
||||
public function __construct(/**
|
||||
* The authentication factory instance.
|
||||
*/
|
||||
protected Auth $auth)
|
||||
{
|
||||
$this->binders = Domain::getBindables();
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Middleware;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Closure;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
@@ -49,7 +50,7 @@ class IsDemoUser
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
if ($repository->hasRole($user, 'demo')) {
|
||||
app('log')->info('User is a demo user.');
|
||||
Log::info('User is a demo user.');
|
||||
$request->session()->flash('info', (string) trans('firefly.not_available_demo_user'));
|
||||
$current = $request->url();
|
||||
$previous = $request->session()->previousUrl();
|
||||
|
||||
@@ -114,7 +114,7 @@ class Range
|
||||
|
||||
// send error to view, if it could not set money format
|
||||
if (false === $moneyResult) {
|
||||
app('log')->error('Could not set locale. The following array doesnt work: ', $localeArray);
|
||||
Log::error('Could not set locale. The following array doesnt work: ', $localeArray);
|
||||
app('view')->share('invalidMonetaryLocale', true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user