我的'用户'表:
id,username,email,password,remember_token
使用默认用户模型:
php artisan make:auth
我根据我的数据库进行了一次简单的更新,在模型/控制器和寄存器视图中将“name”更改为“username”。
注册确定,用户在重定向后进行身份验证。
问题在于用户身份验证,我收到此错误:这些凭据与我们的记录不符。
默认登录方法():App \ Http \ Controllers \ Auth \ AuthController @ login
public function login(Request $request)
{
$this->validateLogin($request);
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
$throttles = $this->isUsingThrottlesLoginsTrait();
if ($throttles && $lockedOut = $this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
$credentials = $this->getCredentials($request);
if (Auth::guard($this->getGuard())->attempt($credentials, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
}
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
if ($throttles && ! $lockedOut) {
$this->incrementLoginAttempts($request);
}
return $this->sendFailedLoginResponse($request);
}
答案 0 :(得分:0)
已解决:我已将密码类型更新为varchar(60)。
如果您有自定义用户表,请尊重默认架构!
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});