1
我不想在laravel 4登录后显示登录页面。如果登录用户想访问登录页面,它应该重定向到主页('/')。我正在使用Sentry进行身份验证。Laravel 4登录重定向
filter.php
Route::filter(
'auth', function() {
if (!Sentry::check()) {
return Redirect::to('login');
}
}
routes.php文件
Route::get('login', array('as' => 'login', function() {
return View::make('login');
}))->before('guest');
Route::post('login', '[email protected]');
AuthController.php
function postLogin() {
try {
// Set login credentials
$credentials = array(
'email' => Input::get('email'), 'password' => Input::get('password')
);
// Try to authenticate the user
$user = Sentry::authenticate($credentials, false);
if ($user) {
return Redirect::to('/');
}
} catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
return Redirect::to('login')->withErrors('Login field is required');
}
}
成功登录后,如果,如果请求登录页面,它仍然显示登录页面
请出示您的'客人'过滤器。 – ciruvan
它的laravel的默认值。 –