Mysql 这些凭证与我们的记录不符
当我尝试登录时,我突然在电子邮件字段中使用了laravel 6 这些凭据与我们的记录不匹配 我已经检查了我的数据库,输入的电子邮件是正确的,我得到这个错误 另外,我搜索了很多关于这个问题的信息,但没有找到任何解决方案 注意:我已经尝试过这个功能,但它也不起作用Mysql 这些凭证与我们的记录不符,mysql,laravel,laravel-5,laravel-6,laravel-6.2,Mysql,Laravel,Laravel 5,Laravel 6,Laravel 6.2,当我尝试登录时,我突然在电子邮件字段中使用了laravel 6 这些凭据与我们的记录不匹配 我已经检查了我的数据库,输入的电子邮件是正确的,我得到这个错误 另外,我搜索了很多关于这个问题的信息,但没有找到任何解决方案 注意:我已经尝试过这个功能,但它也不起作用 public function setPasswordAttribute($password) { $this->attributes['password'] = \Hash::make($password); }
public function setPasswordAttribute($password)
{
$this->attributes['password'] = \Hash::make($password);
}
登录控制器
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
试试这个bcrypt
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
可能是你的密码不正确,而不是电子邮件不正确。是正确的。你怎么知道的?您是否在LoginController
check username()函数中运行了\Hash::check
。它是否返回用户名
或电子邮件
?因为您使用电子邮件进行验证,所以返回值必须是email。因为我昨天使用了密码,并且根本没有更改它@MalkhaziDartsmelidzeLaravel提供了一个身份验证框架,可以自动创建密码哈希。出于某种原因,它还包括Hash::make()
。即使没有,PHP也提供了password\u hash
和password\u verify
。很少需要直接使用像bcrypt
这样的函数,在这种情况下当然不需要。