-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Description
I'm using version 4.0.x-dev 5076824 of the Laravel Framework.
For some reason I can't understand, when I'm using the Redirect::intended() method after login I'm always sent to the fournisseurs/ax_getListProduits
URL of my routes file, whatever is my real intended URL, with 2 exceptions:
- if I remove this the post
fournisseurs/ax_getListProduits
route, everything OK - if I add a echo
Session::get('url.intended');
call before the login page display, the correct intended URL is displayed, and it works (if I don't and add this code afterAuth::attempt
, I'm sent tofournisseurs/ax_getListProduits
.
Below are my routes file, and my login controller code:
routes.php
Route::group(array('before' => 'auth'), function() {
Route::get('/', array("as"=>"home", function() {
return Redirect::to("fournisseurs");
}));
Route::resource('usergroups', 'UsergroupsController');
Route::get('fournisseurs/ax_produits', 'FournisseursController@ax_produits');
Route::post('fournisseurs/ax_getProduit', 'FournisseursController@ax_getProduit');
Route::post('fournisseurs/ax_updProduit', 'FournisseursController@ax_updProduit');
Route::post('fournisseurs/ax_getListProduits', 'FournisseursController@ax_getListProduits');
Route::resource('fournisseurs', 'FournisseursController');
Route::resource('adresses', 'AdressesController', array('only' => array('store', 'destroy', 'edit', 'update')));
Route::get('/adresses/create/{frs_id}', array('as'=>'adresses.create', 'uses'=>'AdressesController@create'));
Route::resource('contacts', 'ContactsController', array('only' => array('store', 'destroy', 'edit', 'update')));
Route::get('/contacts/create/{frs_id}', array('as'=>'contacts.create', 'uses'=>'ContactsController@create'));
});
Route::get('login', array('as' => 'login', 'uses' => 'SessionsController@create'));
Route::get('logout', array('as' => 'logout', 'uses' => 'SessionsController@destroy'));
Route::resource('sessions', 'SessionsController', array('only' => array('create', 'store', 'destroy')));
Login controller:
class SessionsController extends BaseController {
public function create()
{
// if I uncomment the following line, everything is OK
// echo Session::get('url.intended');
return View::make('sessions.create');
}
public function store()
{
$input = Input::all();
$attempt = Auth::attempt(array(
"nom" => $input["nom"],
"password" => $input["password"]
));
if($attempt) return Redirect::intended("/");
return Redirect::back()->with("flash_error", "Nom ou mot de passe invalide")->withInput();
}
public function destroy()
{
Auth::logout();
return Redirect::home();
}
}
Metadata
Metadata
Assignees
Labels
No labels