【发布时间】:2015-03-26 19:47:13
【问题描述】:
这是我的 routes.php
<?php
#HomePage
Route::get('/', 'LoginController@home');
Route::post('login', 'LoginController@Login');
Route::group(array('before' => 'auth'), function()
{
Route::get('home', 'HomeController@HomeLayout');
Route::get('logout', 'LoginController@Logout');
});
在退出时我有
public function Logout()
{
Session::flush();
return Redirect::to('');
}
一旦我注销,我就会成功重定向到'' 页面,即 localhost/home,因为我的登录控制器中有这个
public function home()
{
return View::make('login/home');
}
我的问题是,一旦我按下注销并按下后退按钮,我就可以看到 localhost/home,尽管我在 Route::group(array('before' => 'auth'), function() 中使用过它
我还配置了filters.php
Route::filter('guest', function()
{
if (Auth::check()) return Redirect::to('/')->with('Message', 'Please Login to get Access');
});
和
Route::filter('auth', function()
{
if (Auth::guest())
{
if (Request::ajax())
{
return Response::make('Unauthorized', 401);
}
else
{
return Redirect::guest('')->with('Message', 'Please Login to get Access');
}
}
});
注意:一旦我刷新它会直接注销,但我什至不想在刷新之前显示主页
如何防止在他们退出后按浏览器的返回按钮后显示主屏幕?
【问题讨论】:
标签: php authentication laravel laravel-4 laravel-routing