Skip to content

Commit

Permalink
Fix login error display
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne authored and trasher committed Sep 20, 2022
1 parent 19ca636 commit dcbda28
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion front/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
Auth::redirectIfAuthenticated();
} else {
TemplateRenderer::getInstance()->display('pages/login_error.html.twig', [
'error' => $auth->getErr(),
'errors' => $auth->getErrors(),
'login_url' => $CFG_GLPI["root_doc"] . '/front/logout.php?noAUTO=1' . str_replace("?", "&", $REDIRECT),
]);
exit();
Expand Down
2 changes: 1 addition & 1 deletion src/Api/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ protected function initSession($params = [])

// login on glpi
if (!$auth->login($params['login'], $params['password'], $noAuto, false, $params['auth'])) {
$err = Toolbox::stripTags($auth->getErr());
$err = implode(' ', $auth->getErrors());
if (
isset($params['user_token'])
&& !empty($params['user_token'])
Expand Down
2 changes: 2 additions & 0 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ public function getAlternateAuthSystemsUserLogin($authtype = 0)
* Get the current identification error
*
* @return string current identification error
*
* @TODO Deprecate this in GLPI 10.1.
*/
public function getErr()
{
Expand Down
4 changes: 3 additions & 1 deletion templates/pages/login_error.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
{{ __("Error") }}
</h4>
<div>
{{ error }}
{% for error in errors %}
{{ error }}<br />
{% endfor %}
</div>

<a href="{{ login_url }}" class="btn btn-primary mt-3">
Expand Down

0 comments on commit dcbda28

Please sign in to comment.