2016-02-27 126 views
3

我的 '用戶' 表:Laravel 5.2認證錯誤

id,username,email,password,remember_token 

使用默認的用戶模式:

php artisan make:auth 

我根據我的DB只取得了一個簡單的更新,改變 「名稱」 爲「用戶名「在模型/控制器和註冊視圖中。

註冊爲確定並且用戶在重定向後被認證。

問題出在用戶認證,我得到這個錯誤:這些憑據不符合我們的記錄。

默認的登錄方法():應用程序\ HTTP \ \控制器驗證\ AuthController @登錄

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

解決:只是我已經更新密碼的類型爲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(); 
    });