1. 修改ROUTE

// Authentication routes...
Route::get('login', 'Auth\AuthController@getLogin');
Route::post('login', 'Auth\AuthController@postLogin');
Route::get('logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('register', 'Auth\AuthController@getRegister');
Route::post('register', 'Auth\AuthController@postRegister');

 

2.AuthController添加字段

    protected $redirectPath = '/page';  //PasswordController中也要添加此项,在更改密码后跳转
    protected $loginPath = '/login';
    protected $redirectAfterLogout = '/page';
    protected $username = 'name';

 

3.修改MiddleWare下的Authenticate与RedirectIfAuthenticated

class Authenticate
{
...
    public function handle($request, Closure $next)
    {
...
            } else {
                return redirect()->guest('login');  //修改这里!
class RedirectIfAuthenticated
{

    public function handle($request, Closure $next)
    {
        if ($this->auth->check()) {
            return redirect('/');  //修改这里!

 

posted on 2015-08-19 20:40  jzfan  阅读(1037)  评论(0编辑  收藏  举报