I have just started to learn laravel, when doing login encountered a very difficult problem.
It was all right, but when I changed the user table structure (adding a column), I could not log in, even after deleting the added column still can't log in, click Login and then jump back to the login page, the HTTP status code is 200.
Even more bizarre is that I added DD (' AAA ') to the Postlogin method after the program did not terminate and print ' AAA ', but continue to return to the login page, as if the program suddenly out of my control. Then I canceled all the controller's auth middleware found that all the query function is normal, the new modification delete function is not good, and did not report any error, the problem in the end where? Online and so on!
public function postLogin(Request $request){ dd('aaa'); $this->validate($request, [ 'username' => 'required', 'password' => 'required', ]); $credentials = $request->only('username', 'password'); if ($this->auth->attempt($credentials, $request->has('remember'))) { return redirect()->intended($this->redirectPath()); } return redirect($this->loginPath()) ->withInput($request->only('username', 'remember')) ->withErrors([ 'username' => $this->getFailedLoginMessage(), ]);}
Reply content:
I have just started to learn laravel, when doing login encountered a very difficult problem.
It was all right, but when I changed the user table structure (adding a column), I could not log in, even after deleting the added column still can't log in, click Login and then jump back to the login page, the HTTP status code is 200.
Even more bizarre is that I added DD (' AAA ') to the Postlogin method after the program did not terminate and print ' AAA ', but continue to return to the login page, as if the program suddenly out of my control. Then I canceled all the controller's auth middleware found that all the query function is normal, the new modification delete function is not good, and did not report any error, the problem in the end where? Online and so on!
public function postLogin(Request $request){ dd('aaa'); $this->validate($request, [ 'username' => 'required', 'password' => 'required', ]); $credentials = $request->only('username', 'password'); if ($this->auth->attempt($credentials, $request->has('remember'))) { return redirect()->intended($this->redirectPath()); } return redirect($this->loginPath()) ->withInput($request->only('username', 'remember')) ->withErrors([ 'username' => $this->getFailedLoginMessage(), ]);}