Commit d27a20b2 authored by Fabien Potencier's avatar Fabien Potencier

removed unneeded start() calls for the session

parent b6658610
...@@ -173,11 +173,9 @@ Always keep in mind the following two golden rules: ...@@ -173,11 +173,9 @@ Always keep in mind the following two golden rules:
* The ``check_path`` path must always be defined **inside** the secured area. * The ``check_path`` path must always be defined **inside** the secured area.
For the login form to work, create a controller where you start the session:: For the login form to work, create a controller like the following::
$app->get('/login', function(Request $request) use ($app) { $app->get('/login', function(Request $request) use ($app) {
$app['session']->start();
return $app['twig']->render('login.html', array( return $app['twig']->render('login.html', array(
'error' => $app['security.last_error']($request), 'error' => $app['security.last_error']($request),
'last_username' => $app['session']->get('_security.last_username'), 'last_username' => $app['session']->get('_security.last_username'),
......
...@@ -66,7 +66,6 @@ authenticates a user and creates a session for him:: ...@@ -66,7 +66,6 @@ authenticates a user and creates a session for him::
$password = $app['request']->server->get('PHP_AUTH_PW'); $password = $app['request']->server->get('PHP_AUTH_PW');
if ('igor' === $username && 'password' === $password) { if ('igor' === $username && 'password' === $password) {
$app['session']->start();
$app['session']->set('user', array('username' => $username)); $app['session']->set('user', array('username' => $username));
return $app->redirect('/account'); return $app->redirect('/account');
} }
...@@ -78,7 +77,6 @@ authenticates a user and creates a session for him:: ...@@ -78,7 +77,6 @@ authenticates a user and creates a session for him::
}); });
$app->get('/account', function () use ($app) { $app->get('/account', function () use ($app) {
$app['session']->start();
if (null === $user = $app['session']->get('user')) { if (null === $user = $app['session']->get('user')) {
return $app->redirect('/login'); return $app->redirect('/login');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment