diff --git a/pandora_console/index.php b/pandora_console/index.php index f26bbdd5d9..b78590f8ef 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -288,14 +288,20 @@ if (! isset ($config['id_user'])) { $nick_in_db = $_SESSION["prepared_login_da"]['id_user']; $expired_pass = false; } - else if (($config['auth'] == 'saml') && $login_button_saml && !is_user_admin($nick)) { - include_once(ENTERPRISE_DIR . "/include/auth/saml.php"); - $saml_user_id = saml_process_user_login(); - $nick_in_db = $saml_user_id; - if (!$nick_in_db) { - require_once('/opt/simplesamlphp/lib/_autoload.php'); - $as = new SimpleSAML_Auth_Simple('PandoraFMS'); - $as->logout(); + else if (($config['auth'] == 'saml') && $login_button_saml) { + if (!is_user_admin($nick)) { + include_once(ENTERPRISE_DIR . "/include/auth/saml.php"); + $saml_user_id = saml_process_user_login(); + $nick_in_db = $saml_user_id; + if (!$nick_in_db) { + require_once('/opt/simplesamlphp/lib/_autoload.php'); + $as = new SimpleSAML_Auth_Simple('PandoraFMS'); + $as->logout(); + } + } + else { + $config["auth_error"] = "Error - Cannot log in as admin with 'login with saml' button"; + $nick_in_db = false; } } else {