From a15ee1d729ef348f6d291671434e16d2cc7b51ef Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Wed, 29 May 2013 20:43:56 +0200 Subject: [PATCH] Fix #953 Close session properly Fix tests --- lib/Alchemy/Phrasea/Authentication/Authenticator.php | 2 +- lib/Alchemy/Phrasea/Controller/Root/Login.php | 2 +- tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Authentication/Authenticator.php b/lib/Alchemy/Phrasea/Authentication/Authenticator.php index afad7b07c9..1295334ef9 100644 --- a/lib/Alchemy/Phrasea/Authentication/Authenticator.php +++ b/lib/Alchemy/Phrasea/Authentication/Authenticator.php @@ -117,7 +117,7 @@ class Authenticator */ public function closeAccount() { - $this->session->clear(); + $this->session->invalidate(); $this->reinitUser(); return $this; diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index 575f3809b7..9db52a9417 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -631,7 +631,7 @@ class Login implements ControllerProviderInterface $app['dispatcher']->dispatch(PhraseaEvents::LOGOUT, new LogoutEvent($app)); $app['authentication']->closeAccount(); - $app->addFlash('info', 'Vous etes maintenant deconnecte. A bientot.'); + $app->addFlash('info', _('Vous etes maintenant deconnecte. A bientot.')); $response = new RedirectResponse($app->path('root', array( 'redirect' => $request->query->get("redirect") diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php index fae6406367..a2853ad984 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/LoginTest.php @@ -57,8 +57,8 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testLoginError($type, $message) { - self::$DI['app']->addFlash($type, $message); self::$DI['app']['authentication']->closeAccount(); + self::$DI['app']->addFlash($type, $message); $crawler = self::$DI['client']->request('GET', '/login/'); @@ -342,9 +342,9 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testRenewPasswordPageShowsFlashMessages($type, $message) { + self::$DI['app']['authentication']->closeAccount(); self::$DI['app']->addFlash($type, $message); - self::$DI['app']['authentication']->closeAccount(); $token = self::$DI['app']['tokens']->getUrlToken(\random::TYPE_PASSWORD, self::$DI['user']->get_id()); $crawler = self::$DI['client']->request('GET', '/login/renew-password/', array(