diff --git a/application/modules/opac/controllers/CasServerController.php b/application/modules/opac/controllers/CasServerController.php
index 503cd6996d281c4e87a66ebe0d26c7d4d91d5e4a..287d62820df0cf5ed183e4106b4020ee65c7774a 100644
--- a/application/modules/opac/controllers/CasServerController.php
+++ b/application/modules/opac/controllers/CasServerController.php
@@ -48,9 +48,10 @@ class CasServerController extends Zend_Controller_Action {
 			if (!ZendAfi_Auth::getInstance()->authenticateLoginPassword($username, $password))
 				echo "identifiant incorrect";
 				//return $this->view->_('Identifiant ou mot de passe incorrect.');
-				
-		$user = Class_Users::getIdentity();
-		$this->_helper->trackEvent('authentification', 'login', $user->getId());
+			else {
+				$user = Class_Users::getIdentity();
+				$this->_helper->trackEvent('authentification', 'login', $user->getId());
+			}
 		$ticket = Zend_Session::getId();
 //		$this->_redirect($this->addURLparameter($service,['ticket' => $ticket]));
 	}