简体   繁体   中英

Laravel 5: After login the user is was redirected to /home. How to change that?

I have created my own root page ( / ) as well as my register page ( /cadastrar ). My next step was to allow the user to login and update their information. For that I just used laravel's login page ( /auth/login ). It works fine and when I login I get redirected to /home . At this point my problem arises: I can not go to any other page ( / ) ( /cadastrar ). I always get redirected back to /home .

I did not change any configuration regarding login or redirections so what could be wrong and how to fix it?

EDIT: At my ( / ) I have a Sign in link. When I click, I go to ( /auth/login ). I put my email and password, press login and it redirects me to ( /home ) saying that I'm logged in. Now I want to go to ( / ) or any other page, but it always redirect me to ( /home ). Thats my problem. My plan was to let the users update their information only if they are logged in, but now I can't go anywhere.

In app/Http/Middleware/RedirectIfAuthenticated.php on line 38 change:

return new RedirectResponse(url('/home'));

to

return new RedirectResponse(url('/'));

我注意到,当我进入WelcomeController并注释了__construct函数中的行时,该行仅将此页面分配给来宾,重定向问题消失了:

//$this->middleware('guest');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM