Improve code quality.

This commit is contained in:
James Cole
2018-07-09 19:24:08 +02:00
parent 76386dad7d
commit 5665f127aa
55 changed files with 278 additions and 100 deletions

View File

@@ -89,9 +89,11 @@ class Authenticate
if (empty($guards)) {
try {
// go for default guard:
/** @noinspection PhpUndefinedMethodInspection */
if ($this->auth->check()) {
// do an extra check on user object.
/** @noinspection PhpUndefinedMethodInspection */
$user = $this->auth->authenticate();
if (1 === (int)$user->blocked) {
$message = (string)trans('firefly.block_account_logout');
@@ -99,6 +101,7 @@ class Authenticate
$message = (string)trans('firefly.email_changed_logout');
}
app('session')->flash('logoutMessage', $message);
/** @noinspection PhpUndefinedMethodInspection */
$this->auth->logout();
throw new AuthenticationException('Blocked account.', $guards);
@@ -114,13 +117,14 @@ class Authenticate
);
// @codeCoverageIgnoreEnd
}
/** @noinspection PhpUndefinedMethodInspection */
return $this->auth->authenticate();
}
// @codeCoverageIgnoreStart
foreach ($guards as $guard) {
if ($this->auth->guard($guard)->check()) {
/** @noinspection PhpVoidFunctionResultUsedInspection */
return $this->auth->shouldUse($guard);
}
}