Skip to content

Commit

Permalink
Merge pull request #62 from Probesys/imp/messages-error-oauth
Browse files Browse the repository at this point in the history
Show message when Azure oAuth failed
  • Loading branch information
ctresvaux committed Nov 27, 2023
2 parents 039ca86 + 2cc4b45 commit ad4273d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/Security/OAuthAuthenticator.php
Expand Up @@ -84,12 +84,12 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
*/
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
{
$loginUrl = $this->router->generate('app_login', [], UrlGeneratorInterface::ABSOLUTE_URL);
$microsoftLogoutUrl = "https://login.windows.net/common/oauth2/logout?post_logout_redirect_uri=$loginUrl";
// $loginUrl = $this->router->generate('app_login', [], UrlGeneratorInterface::ABSOLUTE_URL);
// $microsoftLogoutUrl = "https://login.windows.net/common/oauth2/logout?post_logout_redirect_uri=$loginUrl";

$this->flashBag->add(
'error',
new TranslatableMessage('user.login.not_found_oauth', ['url' => $microsoftLogoutUrl])
new TranslatableMessage('Generics.messages.incorrectCredential')
);

throw $exception->getPrevious() ?? $exception;
Expand Down
5 changes: 5 additions & 0 deletions app/templates/security/login.html.twig
Expand Up @@ -9,6 +9,11 @@
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
{% for label, messages in app.flashes %}
{% for message in messages %}
<div class="alert alert-danger">{{ message | trans }}</div>
{% endfor %}
{% endfor %}
<div class="mb-3"><img class="logo" src="{{ asset('img/agent-j-logo-desktop.svg') }}" /></div>
<h1 class="mb-5 font-weight-bolder">{{ 'Generics.messages.welcomeHomeMessage'|trans|raw }}</h1>

Expand Down

0 comments on commit ad4273d

Please sign in to comment.