Remove debug logging.

This commit is contained in:
James Cole
2023-04-26 06:41:06 +02:00
parent 270ac87e65
commit ea53b34cbb
2 changed files with 0 additions and 12 deletions

View File

@@ -85,14 +85,11 @@ abstract class Controller extends BaseController
{ {
$bag = new ParameterBag(); $bag = new ParameterBag();
$page = (int)request()->get('page'); $page = (int)request()->get('page');
Log::debug(sprintf('Page is %d', $page));
if ($page < 1) { if ($page < 1) {
$page = 1; $page = 1;
Log::debug(sprintf('Page is less than zero, is now %d', $page));
} }
if ($page > pow(2,16)) { if ($page > pow(2,16)) {
$page = pow(2,16); $page = pow(2,16);
Log::debug(sprintf('Page is more than %d, is now %d', pow(2,16), $page));
} }
$bag->set('page', $page); $bag->set('page', $page);

View File

@@ -87,13 +87,10 @@ class Authenticate
*/ */
protected function authenticate($request, array $guards) protected function authenticate($request, array $guards)
{ {
Log::debug(sprintf('Now in %s', __METHOD__));
if (0 === count($guards)) { if (0 === count($guards)) {
Log::debug('No guards present.');
// go for default guard: // go for default guard:
/** @noinspection PhpUndefinedMethodInspection */ /** @noinspection PhpUndefinedMethodInspection */
if ($this->auth->check()) { if ($this->auth->check()) {
Log::debug('Default guard says user is authenticated.');
// do an extra check on user object. // do an extra check on user object.
/** @noinspection PhpUndefinedMethodInspection */ /** @noinspection PhpUndefinedMethodInspection */
/** @var User $user */ /** @var User $user */
@@ -104,18 +101,13 @@ class Authenticate
/** @noinspection PhpUndefinedMethodInspection */ /** @noinspection PhpUndefinedMethodInspection */
return $this->auth->authenticate(); return $this->auth->authenticate();
} }
Log::debug('Guard array is not empty.');
foreach ($guards as $guard) { foreach ($guards as $guard) {
Log::debug(sprintf('Now in guard loop, guard is "%s"', $guard));
if ('api' !== $guard) { if ('api' !== $guard) {
Log::debug('Guard is "api", call authenticate()');
$this->auth->guard($guard)->authenticate(); $this->auth->guard($guard)->authenticate();
} }
$result = $this->auth->guard($guard)->check(); $result = $this->auth->guard($guard)->check();
Log::debug(sprintf('Result is %s', var_export($result, true)));
if ($result) { if ($result) {
Log::debug('Guard says user is authenticated.');
$user = $this->auth->guard($guard)->user(); $user = $this->auth->guard($guard)->user();
$this->validateBlockedUser($user, $guards); $this->validateBlockedUser($user, $guards);
// According to PHPstan the method returns void, but we'll see. // According to PHPstan the method returns void, but we'll see.
@@ -134,7 +126,6 @@ class Authenticate
*/ */
private function validateBlockedUser(?User $user, array $guards): void private function validateBlockedUser(?User $user, array $guards): void
{ {
Log::debug(sprintf('Now in %s', __METHOD__));
if (null === $user) { if (null === $user) {
Log::warning('User is null, throw exception?'); Log::warning('User is null, throw exception?');
} }