Skip to content

Commit

Permalink
optimization on auth error - read username
Browse files Browse the repository at this point in the history
  • Loading branch information
xprojects-de committed Oct 25, 2024
1 parent 63f41c5 commit 47b553d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Security/AlpdeskcoreTokenAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio

$data = ['type' => AlpdeskCoreConstants::$ERROR_INVALID_AUTH, 'username' => $username, 'message' => \strtr($exception->getMessage(), $exception->getMessageData())];

$logEntry = 'Username:' . $username . ' => ' . \strtr($exception->getMessage(), $exception->getMessageData());
$logEntry = \strtr($exception->getMessage(), $exception->getMessageData());
if (\is_string($username) && $username !== '') {
$logEntry .= ' (Username: ' . $username . ')';
}

$this->logger->error($logEntry, __METHOD__);

return new JsonResponse($data, Response::HTTP_FORBIDDEN);
Expand Down

0 comments on commit 47b553d

Please sign in to comment.