Home > Backend Development > PHP Tutorial > Why does the account and password keep getting wrong?

Why does the account and password keep getting wrong?

WBOY
Release: 2016-07-06 13:51:35
Original
1423 people have browsed it

<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>
Copy after login
Copy after login

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

Reply content:

<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>
Copy after login
Copy after login

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template