Laravel 5:登录后,用户被重定向到/home.如何改变呢? [英] Laravel 5: After login the user is was redirected to /home. How to change that?

查看:75
本文介绍了Laravel 5:登录后,用户被重定向到/home.如何改变呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了自己的根页面(/)和注册页面(/cadastrar).我的下一步是允许用户登录并更新他们的信息.为此,我只使用了laravel的登录页面(/auth/login).它工作正常,当我登录时,我被重定向到/home.此时出现了我的问题:我无法转到任何其他页面(/)(/cadastrar). 我总是被重定向回/home .

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?

编辑:在我(/)处,我有一个登录链接.单击时,转到(/auth/login).我输入了我的电子邮件和密码,然后按登录键,它会将我重定向到(/home),说我已登录.现在我想转到(/)或任何其他页面,但是它始终将我重定向到( /home).多数民众赞成在我的问题. 我的计划是让用户仅在登录后才更新其信息,但现在我无处可去.

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.

推荐答案

app/Http/Middleware/RedirectIfAuthenticated.php第38行中进行更改:

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

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

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

这篇关于Laravel 5:登录后,用户被重定向到/home.如何改变呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆