<code>public function postLogin(Request $request) { if($input=Input::all()){ if(!Auth::attempt(['phone' => $input['mobile'], 'password' => $input['password']])){ return back()->with('msg', '用户名或者密码错误!'); } return redirect(''); }</code>
I keep getting errors when using this method. Why? I tried it and the account and password are correct, but I keep getting errors because the username or password is wrong
<code>public function postLogin(Request $request) { if($input=Input::all()){ if(!Auth::attempt(['phone' => $input['mobile'], 'password' => $input['password']])){ return back()->with('msg', '用户名或者密码错误!'); } return redirect(''); }</code>
I keep getting errors when using this method. Why? I tried it and the account and password are correct, but I keep getting errors because the username or password is wrong
If you make sure your username and password are correct. Then you have to take a look at how your Auth::attempt()
handles usernames and passwords. It is very likely that the problem lies in Auth::attempt()
Output the sql statement executed to see if the user password entered is correct
<code class="php">\DB::connection()->enableQueryLog(); $queries = \DB::getQueryLog();dd($queries );</code>