douanrang4728 2018-10-10 13:00
浏览 779

Laravel 5.7登录重定向到404页面

I'm having an issue now after installing laravel-math-captcha though it was working fine for 2 days with Laravel 5.7 when I login with correct credentials I get redirected to a 404 page. I debug the login process

die($this->sendLoginResponse($request));

and I get

HTTP/1.0 302 Found Cache-Control: no-cache, private Date: Wed, 10 Oct 2018 13:01:35 GMT Location: http://127.0.0.1:9500/404 Redirecting to http://127.0.0.1:9500/404. 

When I navigate to /home I find that I successfully logged in

Any idea how to solve this issue and why did it appear?

[Update]

LoginController

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{

  public $decayMinutes = 1;
  public $maxAttempts = 10;

  use AuthenticatesUsers;

  protected $redirectTo = '/';

  public function __construct()
  {
    $this->middleware('guest', ['except' => 'logout']);
  }

}

Login function from AuthenticatesUsers

public function login(Request $request)
{
    $this->validateLogin($request);

    if ($this->hasTooManyLoginAttempts($request)) {
        $this->fireLockoutEvent($request);

        return $this->sendLockoutResponse($request);
    }

    if ($this->attemptLogin($request)) {
        return $this->sendLoginResponse($request);
    }

    $this->incrementLoginAttempts($request);

    return $this->sendFailedLoginResponse($request);
}
  • 写回答

3条回答 默认 最新

  • donglin1692 2018-10-10 13:06
    关注

    I think your form action url is wrong, could you update your post and show us how you built your form? If you take a look at the response you got, you can clearly see that you called 404 page. If this is not the case, then please include the LoginController code too

    Try and change the line inside the LoginController to:

    protected $redirectTo = '/home';
    
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!