[英]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
. 我经常使用Laravel创建一个登录名,并且登录运行平稳,但是我不了解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
. 我正在尝试使登录过程由我自己运行,而不需要Laravel make:auth
。 create a user table with a password that hashed. 创建具有哈希密码的用户表。 when logging in Auth::attempt
is always false
, why? 登录Auth::attempt
始终为false
,为什么?
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));
如果i dd(Auth::attempt($credentials));
此功能在Laravel手动验证用户的文档中dd(Auth::attempt($credentials));
always return false
, so it can't go to route /home
: 始终返回false
,因此它不能转到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更好地使用基本身份验证,并逐步检查所有前端到后端的工作,并查看将数据正确发送到后端
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.