From e21b4243ca206a516cce09b3fb3d1015aa46c361 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 9 Jul 2014 12:53:25 +0200 Subject: [PATCH] Fix error message when no authentication method available The error handling for configuration files has slightly changed (non existent files are treated as empty) so the authentication chain handling needed to be adjusted as well. fixes #6268 --- .../controllers/AuthenticationController.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/application/controllers/AuthenticationController.php b/application/controllers/AuthenticationController.php index 5fbe4644a..cfbbafe4d 100644 --- a/application/controllers/AuthenticationController.php +++ b/application/controllers/AuthenticationController.php @@ -77,14 +77,14 @@ class AuthenticationController extends ActionController new Exception('Cannot load authentication configuration. An exception was thrown:', 0, $e) ); throw new ConfigurationError( - 'No authentication methods available. It seems that none authentication method has been set' - . ' up. Please check the system log or Icinga Web 2 log for more information' + t( + 'No authentication methods available. Authentication configuration could not be loaded.' + . ' Please check the system log or Icinga Web 2 log for more information' + ) ); } $chain = new AuthChain($config); - - if ($this->getRequest()->isGet()) { $user = new User(''); foreach ($chain as $backend) { @@ -119,7 +119,15 @@ class AuthenticationController extends ActionController $this->rerenderLayout()->redirectNow($redirectUrl); } } - if ($backendsWithError === $backendsTried) { + if ($backendsTried === 0) { + throw new ConfigurationError( + t( + 'No authentication methods available. It seems that no authentication method has been set' + . ' up. Please check the system log or Icinga Web 2 log for more information' + ) + ); + } + if ($backendsTried === $backendsWithError) { throw new ConfigurationError( $this->translate( 'No authentication methods available. It seems that all set up authentication methods have'