diff --git a/library/Class/WebService/SIGB/AbstractRESTService.php b/library/Class/WebService/SIGB/AbstractRESTService.php
index 1bbd86e0c4688bc09489da655a94ad120e4c2a18..9bf4f6d446b85f39d78a2bbf1127ddc8d638113c 100644
--- a/library/Class/WebService/SIGB/AbstractRESTService.php
+++ b/library/Class/WebService/SIGB/AbstractRESTService.php
@@ -153,6 +153,7 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
 	/**
 	 * Authentifie un utilisateur via SIGB et si réussi affecte l'id_sigb reçu
 	 * @param $user Class_Users
+	 * @return boolean true if successful
 	 */
 	public function ilsdiAuthenticatePatron($user) {
 		$params = ['service' => 'AuthenticatePatron',
@@ -161,10 +162,12 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
 
 		$xml = $this->httpGet($params);
 
-		if ('' != $patronId = $this->_getTagData($xml, 'patronId'))
+		if ('' != $patronId = $this->_getTagData($xml, 'patronId')) {
 			$user->setIdSigb($patronId);
+			return true;
+		}
 
-		return $this;
+		return false;
 	}
 		
 
diff --git a/library/Class/WebService/SIGB/Nanook/Service.php b/library/Class/WebService/SIGB/Nanook/Service.php
index 2439f5f16b01205cdba9ef61f0f20c39f8d59ac4..12d587ec29484988626c81ab43190b46aed04332 100644
--- a/library/Class/WebService/SIGB/Nanook/Service.php
+++ b/library/Class/WebService/SIGB/Nanook/Service.php
@@ -35,10 +35,11 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
 	 * @return Class_WebService_SIGB_Emprunteur
 	 */
 	public function getEmprunteur($user) {
-		return $this
-			->ilsdiAuthenticatePatron($user)
-			->ilsdiGetPatronInfo(array('patronId' => $user->getIdSigb()),
-													 Class_WebService_SIGB_Nanook_PatronInfoReader::newInstance());
+		if (!$this->ilsdiAuthenticatePatron($user))
+			return Class_WebService_SIGB_Emprunteur::nullInstance();
+		
+		return $this->ilsdiGetPatronInfo(['patronId' => $user->getIdSigb()],
+																		 Class_WebService_SIGB_Nanook_PatronInfoReader::newInstance());
 	}
 
 
@@ -54,9 +55,9 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
 			$code_annexe = $annexe->getCode();
 
 		return $this->ilsdiHoldTitle(
-																 array('bibId'					=> $exemplaire->getIdOrigine(),
-																			 'patronId'       => $user->getIdSigb(),
-																			 'pickupLocation'	=> $code_annexe));
+            array('bibId'					=> $exemplaire->getIdOrigine(),
+                  'patronId'       => $user->getIdSigb(),
+                  'pickupLocation'	=> $code_annexe));
 	}
 
 
@@ -67,8 +68,8 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
 	 */
 	public function supprimerReservation($user, $reservation_id) {
 		return $this->ilsdiCancelHold(array(
-																				'patronId'	=> $user->getIdSigb(),
-																				'itemId'		=> $reservation_id));
+                                          'patronId'	=> $user->getIdSigb(),
+                                          'itemId'		=> $reservation_id));
 	}
 
 
@@ -79,8 +80,8 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
 	 */
 	public function prolongerPret($user, $pret_id) {
 		return $this->ilsdiRenewLoan(array(
-																			 'patronId'	=> $user->getIdSigb(),
-																			 'itemId'		=> $pret_id));
+                                         'patronId'	=> $user->getIdSigb(),
+                                         'itemId'		=> $pret_id));
 	}
 
 
@@ -91,7 +92,7 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
 	public function getNotice($id) {
 		try {
 			return $this->ilsdiGetRecords($id, 
-				Class_WebService_SIGB_Nanook_GetRecordsResponseReader::newInstance());
+                                          Class_WebService_SIGB_Nanook_GetRecordsResponseReader::newInstance());
 		} catch (Exception $e) {
 			return;
 		}
@@ -105,8 +106,8 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
 	public function buildQueryURL($options) {
 		$parts = array();
 		foreach ($options as $key => $value) {
-				$value = urlencode($value);
-				$parts[] = $key . '/' . $value;
+            $value = urlencode($value);
+            $parts[] = $key . '/' . $value;
 		}
 
 		return $this->getServerRoot() . implode('/', $parts);
diff --git a/scripts/opac3.el b/scripts/opac3.el
index 44639e5847a3e460bb664b7b825a4d61dcdcd9d5..c483b44a3b7fb50f5f0c3e7eb62429f44044c07b 100644
--- a/scripts/opac3.el
+++ b/scripts/opac3.el
@@ -433,5 +433,3 @@
   
 ;; ('magit diff --stat -- opac3-cur-dir)
 )
-
-(global-set-key (kbd "C-c ms") 'magit-status-cur-dir)
diff --git a/tests/library/Class/WebService/SIGB/NanookTest.php b/tests/library/Class/WebService/SIGB/NanookTest.php
index 969d6af0019dc98396d791050d95d23f27122a50..6d7f014d93d0e3dfd8648941f568f6ccbba74765 100644
--- a/tests/library/Class/WebService/SIGB/NanookTest.php
+++ b/tests/library/Class/WebService/SIGB/NanookTest.php
@@ -79,9 +79,9 @@ abstract class NanookTestCase extends Storm_Test_ModelTestCase {
 			->setWebClient($this->_mock_web_client);
 
 		$annexe_cran = Class_CodifAnnexe::getLoader()->newInstanceWithId(3)
-								->setLibelle('Annexe Cran-Gevrier')
-								->setIdBib(3)
-			          ->setCode(10);
+			->setLibelle('Annexe Cran-Gevrier')
+			->setIdBib(3)
+			->setCode(10);
 
 		Storm_Test_ObjectWrapper::onLoaderOfModel('Class_CodifAnnexe')
 			->whenCalled('findFirstBy')->answers(null)
@@ -97,29 +97,29 @@ abstract class NanookServiceErrorTestCase extends NanookTestCase {
 	/** @test */
 	public function reserverExemplaireShouldReturnFailure() {
 		$this->assertEquals(
-				array('statut' => false, 'erreur' => 'Service indisponible'),
-				$this->_service->reserverExemplaire(
-								Class_Users::getLoader()->newInstance()->setIdSigb(1),
-								Class_Exemplaire::getLoader()->newInstance()->setIdOrigine(''),
-								''));
+			array('statut' => false, 'erreur' => 'Service indisponible'),
+			$this->_service->reserverExemplaire(
+				Class_Users::getLoader()->newInstance()->setIdSigb(1),
+				Class_Exemplaire::getLoader()->newInstance()->setIdOrigine(''),
+				''));
 	}
 
 
 	/** @test */
 	public function supprimerReservationShouldReturnFailure() {
 		$this->assertEquals(
-				array('statut' => false, 'erreur' => 'Service indisponible'),
-				$this->_service->supprimerReservation(
-										Class_Users::getLoader()->newInstance()->setIdSigb(1), ''));
+			array('statut' => false, 'erreur' => 'Service indisponible'),
+			$this->_service->supprimerReservation(
+				Class_Users::getLoader()->newInstance()->setIdSigb(1), ''));
 	}
 
 
 	/** @test */
 	public function prolongerPretShouldReturnFailure() {
 		$this->assertEquals(
-				array('statut' => false, 'erreur' => 'Service indisponible'),
-				$this->_service->prolongerPret(
-										Class_Users::getLoader()->newInstance()->setIdSigb(1), ''));
+			array('statut' => false, 'erreur' => 'Service indisponible'),
+			$this->_service->prolongerPret(
+				Class_Users::getLoader()->newInstance()->setIdSigb(1), ''));
 	}
 
 
@@ -139,8 +139,8 @@ class NanookNoConnectionTest extends NanookServiceErrorTestCase {
 		$this->_mock_web_client
 			->whenCalled('open_url')
 			->willDo(function () {
-				throw new Zend_Http_Client_Adapter_Exception('Unable to connect');
-			});
+			throw new Zend_Http_Client_Adapter_Exception('Unable to connect');
+		});
 	}
 }
 
@@ -158,8 +158,8 @@ class NanookHtmlResponseErrorTest extends NanookServiceErrorTestCase {
 			->answers(NanookFixtures::htmlTomcatError());
 
 		$this->_emprunteur = $this->_service->getEmprunteur(Class_Users::getLoader()
-																								 ->newInstance()
-																								 ->setIdSigb(1));
+																												->newInstance()
+																												->setIdSigb(1));
 	}
 
 
@@ -324,21 +324,21 @@ class NanookGetNoticeLiliGrisbiAndCoTest extends NanookTestCase {
 	/** @test */
 	public function fourthExemplaireShouldBeEnTransit() {
 		$this->assertEquals(Class_WebService_SIGB_Exemplaire::DISPO_TRANSIT,
-			                  $this->_notice->exemplaireAt(3)->getDisponibilite());
+												$this->_notice->exemplaireAt(3)->getDisponibilite());
 	}
 
 
 	/** @test */
 	public function fiftExemplaireShouldBeDejaReserve() {
 		$this->assertEquals(Class_WebService_SIGB_Exemplaire::DISPO_DEJA_RESERVE,
-			                  $this->_notice->exemplaireAt(4)->getDisponibilite());
+												$this->_notice->exemplaireAt(4)->getDisponibilite());
 	}
 
 
 	/** @test */
 	public function sixthExemplaireShouldBeEnCommande() {
 		$this->assertEquals(Class_WebService_SIGB_Exemplaire::DISPO_EN_COMMANDE,
-			                  $this->_notice->exemplaireAt(5)->getDisponibilite());
+												$this->_notice->exemplaireAt(5)->getDisponibilite());
 	}
 }
 
@@ -369,11 +369,17 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase {
 		parent::setUp();
 
 		$this->_mock_web_client
+			->whenCalled('open_url')
+			->with('http://localhost:8080/afi_Nanook/ilsdi/service/AuthenticatePatron/username/8765/password/2002')
+			->answers(NanookFixtures::xmlAuthenticatePatronChristelDelpeyroux())
+
 			->whenCalled('open_url')
 			->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPatronInfo/patronId/1')
 			->answers(NanookFixtures::xmlGetPatronChristelDelpeyroux());
 
-		$this->_chrystel = Class_Users::newInstance(['id_sigb' => 1]);
+		$this->_chrystel = Class_Users::newInstance(['id_sigb' => 1,
+																								 'login' => 8765,
+																								 'password' => 2002]);
 		$this->_emprunteur = $this->_service->getEmprunteur($this->_chrystel);
 		$this->_emprunteur->updateUser($this->_chrystel);
 
@@ -476,35 +482,35 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase {
 	/** @test */
 	public function firstEmpruntTitreShouldBeBeartEnPublic() {
 		$this->assertEquals('Béart en public',
-																$this->_emprunteur->getEmpruntAt(0)->getTitre());
+												$this->_emprunteur->getEmpruntAt(0)->getTitre());
 	}
 
 
 	/** @test */
 	public function firstEmpruntAuthorShouldBeGuyBeart() {
 		$this->assertEquals('Guy Béart',
-																$this->_emprunteur->getEmpruntAt(0)->getAuteur());
+												$this->_emprunteur->getEmpruntAt(0)->getAuteur());
 	}
 
 
 	/** @test */
 	public function firstEmpruntDateRetourShouldBeMayFourth2011() {
 		$this->assertEquals('04/05/2011',
-														$this->_emprunteur->getEmpruntAt(0)->getDateRetour());
+												$this->_emprunteur->getEmpruntAt(0)->getDateRetour());
 	}
 
 
 	/** @test */
 	public function firstEmpruntIdShouldBe196895() {
 		$this->assertEquals('196895',
-																$this->_emprunteur->getEmpruntAt(0)->getId());
+												$this->_emprunteur->getEmpruntAt(0)->getId());
 	}
 
 
 	/** @test */
 	public function firstEmpruntNoticeNumberShouldBe117661() {
 		$this->assertEquals('117661',
-						$this->_emprunteur->getEmpruntAt(0)->getExemplaire()->getNoNotice());
+												$this->_emprunteur->getEmpruntAt(0)->getExemplaire()->getNoNotice());
 	}
 
 
@@ -523,7 +529,7 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase {
 	/** @test */
 	public function secondEmpruntTitreShouldBeLesFinancesPubliquesEtc() {
 		$this->assertEquals('Les Finances publiques et la réforme budgétaire',
-																$this->_emprunteur->getEmpruntAt(1)->getTitre());
+												$this->_emprunteur->getEmpruntAt(1)->getTitre());
 	}
 
 
@@ -543,21 +549,21 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase {
 	/** @test */
 	public function secondEmpruntDateRetourShouldBeMayFourth2029() {
 		$this->assertEquals('04/05/2029',
-														$this->_emprunteur->getEmpruntAt(1)->getDateRetour());
+												$this->_emprunteur->getEmpruntAt(1)->getDateRetour());
 	}
 
 
 	/** @test */
 	public function secondEmpruntIdShouldBe107177() {
 		$this->assertEquals('107177',
-																$this->_emprunteur->getEmpruntAt(1)->getId());
+												$this->_emprunteur->getEmpruntAt(1)->getId());
 	}
 
 
 	/** @test */
 	public function secondEmpruntNoticeNumberShouldBe83413() {
 		$this->assertEquals('83413',
-						$this->_emprunteur->getEmpruntAt(1)->getExemplaire()->getNoNotice());
+												$this->_emprunteur->getEmpruntAt(1)->getExemplaire()->getNoNotice());
 	}
 
 
@@ -582,21 +588,21 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase {
 	/** @test */
 	public function firstReservationTitreShouldBeContesDesQuatreVents() {
 		$this->assertEquals('Contes des quatre vents',
-														$this->_emprunteur->getReservationAt(0)->getTitre());
+												$this->_emprunteur->getReservationAt(0)->getTitre());
 	}
 
 
 	/** @test */
 	public function firstReservationAuthorShouldBeNathaCaputo() {
 		$this->assertEquals('Natha Caputo',
-														$this->_emprunteur->getReservationAt(0)->getAuteur());
+												$this->_emprunteur->getReservationAt(0)->getAuteur());
 	}
 
 
 	/** @test */
 	public function firstReservationNoticeNumberShouldBe7307() {
 		$this->assertEquals('7307',
-					$this->_emprunteur->getReservationAt(0)->getExemplaire()->getNoNotice());
+												$this->_emprunteur->getReservationAt(0)->getExemplaire()->getNoNotice());
 	}
 
 
@@ -621,21 +627,21 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase {
 	/** @test */
 	public function secondReservationTitreShouldBeLeChantDuLac() {
 		$this->assertEquals('Le Chant du lac',
-														$this->_emprunteur->getReservationAt(1)->getTitre());
+												$this->_emprunteur->getReservationAt(1)->getTitre());
 	}
 
 
 	/** @test */
 	public function secondReservationAuthorShouldBeOlympeBhelyQuenum() {
 		$this->assertEquals('Olympe Bhêly-Quénum',
-														$this->_emprunteur->getReservationAt(1)->getAuteur());
+												$this->_emprunteur->getReservationAt(1)->getAuteur());
 	}
 
 
 	/** @test */
 	public function secondReservationNoticeNumberShouldBe12501() {
 		$this->assertEquals('12501',
-					$this->_emprunteur->getReservationAt(1)->getExemplaire()->getNoNotice());
+												$this->_emprunteur->getReservationAt(1)->getExemplaire()->getNoNotice());
 	}
 
 
@@ -663,10 +669,10 @@ class NanookGetEmprunteurWithErrorTest extends NanookTestCase {
 			->answers(NanookFixtures::xmlGetPatronError());
 
 		$emprunteur = $this->_service->getEmprunteur(
-																								 Class_Users::getLoader()
-																								 ->newInstance()
-																								 ->setIdSigb('666')
-																								 );
+			Class_Users::getLoader()
+			->newInstance()
+			->setIdSigb('666')
+			);
 		$this->assertNotNull($emprunteur);
 		$this->assertEmpty($emprunteur->getReservations());
 		$this->assertEmpty($emprunteur->getPretsEnRetard());
@@ -676,9 +682,9 @@ class NanookGetEmprunteurWithErrorTest extends NanookTestCase {
 
 
 
-class NanookGetEmprunteurWithoutIdSigbTest extends NanookTestCase {
+class NanookGetEmprunteurAuthenticateTest extends NanookTestCase {
 	/** @test */
-	public function shouldAuthenticate() {
+	public function withRightUsernameAndPasswordUserShouldAuthenticateButNotBeValid() {
 		$this->_mock_web_client
 			->whenCalled('open_url')
 			->with('http://localhost:8080/afi_Nanook/ilsdi/service/AuthenticatePatron/username/90175000410218/password/1989')
@@ -689,12 +695,37 @@ class NanookGetEmprunteurWithoutIdSigbTest extends NanookTestCase {
 			->answers(NanookFixtures::xmlGetPatronError());
 				
 		$emprunteur = $this->_service->getEmprunteur($user = Class_Users::newInstance()
-			                                                     ->setLogin('90175000410218')
-			                                                     ->setPassword('1989'));
+																								 ->setLogin('90175000410218')
+																								 ->setPassword('1989'));
+
+		$this->assertNotNull($emprunteur);
+		$this->assertEquals(1, $user->getIdSigb());
+		$this->assertFalse($emprunteur->isValid());
+	}
+
+
+    
+	/** @test */
+	public function withWrongPasswordEmprunteurShouldNotBeValid() {
+		$this->_mock_web_client
+			->whenCalled('open_url')
+			->with('http://localhost:8080/afi_Nanook/ilsdi/service/AuthenticatePatron/username/90175000410218/password/1')
+			->answers('<?xml version="1.0" encoding="UTF-8"?><AuthenticatePatron><error>PatronNotFound</error></AuthenticatePatron>')
+
+			->whenCalled('open_url')
+			->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPatronInfo/patronId/1')
+			->answers(NanookFixtures::xmlGetPatronChristelDelpeyroux());
+				
+		$emprunteur = $this->_service->getEmprunteur($user = Class_Users::newInstance()
+																								 ->setLogin('90175000410218')
+																								 ->setPassword('1989')
+																								 ->setIdSigb(1));
 
 		$this->assertNotNull($emprunteur);
 		$this->assertEquals(1, $user->getIdSigb());
+		$this->assertFalse($emprunteur->isValid());
 	}
+    
 }
 
 
@@ -713,10 +744,10 @@ class NanookGetEmprunteurPBTest extends NanookTestCase {
 			->answers(NanookFixtures::xmlGetPatronPB());
 
 		$this->_emprunteur = $this->_service->getEmprunteur(
-														Class_Users::getLoader()
-															->newInstance()
-															->setIdSigb(555)
-													);
+			Class_Users::getLoader()
+			->newInstance()
+			->setIdSigb(555)
+			);
 		Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Exemplaire')
 			->whenCalled('findFirstBy')
 			->answers(null);
@@ -750,8 +781,8 @@ class NanookOperationsTest extends NanookTestCase {
 			$this->_service->prolongerPret(
 				Class_Users::getLoader()->newInstance()	->setIdSigb('1'),
 				'196895'
-			)
-		);
+				)
+			);
 	}
 
 
@@ -767,8 +798,8 @@ class NanookOperationsTest extends NanookTestCase {
 			$this->_service->prolongerPret(
 				Class_Users::getLoader()->newInstance()	->setIdSigb('1'),
 				'196895'
-			)
-		);
+				)
+			);
 	}
 
 
@@ -784,7 +815,7 @@ class NanookOperationsTest extends NanookTestCase {
 													Class_Users::getLoader()->newInstance()	->setIdSigb('1'),
 													Class_Exemplaire::getLoader()->newInstance()->setIdOrigine('196895'),
 													'3'
-												));
+													));
 	}
 
 
@@ -800,7 +831,7 @@ class NanookOperationsTest extends NanookTestCase {
 													Class_Users::getLoader()->newInstance()	->setIdSigb('1'),
 													Class_Exemplaire::getLoader()->newInstance()->setIdOrigine('196895'),
 													'Site Principal'
-												));
+													));
 	}
 
 
@@ -815,7 +846,7 @@ class NanookOperationsTest extends NanookTestCase {
 												$this->_service->supprimerReservation(
 													Class_Users::getLoader()->newInstance()->setIdSigb('1'),
 													'196895'
-												));
+													));
 	}
 
 
@@ -830,6 +861,6 @@ class NanookOperationsTest extends NanookTestCase {
 												$this->_service->supprimerReservation(
 													Class_Users::getLoader()->newInstance()	->setIdSigb('1'),
 													'196895'
-												));
+													));
 	}
 }
\ No newline at end of file