简体   繁体   中英

auth laravel always return false

I often create a login with Laravel, and it runs smoothly, but I don't understand the actual process run by Laravel php artisan make:auth . and now I want to try creating this login process myself to understand the actual process

I'm trying to make the login process run by myself without Laravel make:auth . create a user table with a password that hashed. when logging in Auth::attempt is always false , why?

public function authenticate(Request $request)
{
    $credentials = $request->only('email', 'password');

    if (Auth::attempt($credentials)) {
        // Authentication passed...
        return redirect()->intended('dashboard');
    }
}

This function is in the documentation of Laravel Manually Authenticating Users if i dd(Auth::attempt($credentials)); always return false , so it can't go to route /home :

and my register controller like this:

public function create()
{
    $user = User::create([
        'name' => Input::get('name'),
        'email' => Input::get('email'),
        'password' => Hash::make(Input::get('password')),
    ]);

    return redirect::back();
}

how to deal with this?

我认为laravel使用json回调和middlware,并且某些处理的会话和cookie更好地使用基本身份验证,并逐步检查所有前端到后端的工作,并查看将数据正确发送到后端

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM