2016-03-21 14 views
0

Şu anda bir laravel 5 projesinde çalışıyorum. Özel şifrelememi şifreler için kullanmak istiyorum, bu yüzden bir işlev yaptım ve kullanmaya çalışıyorum. İlk olarak, postLogin işlevini geçersiz kıldım ve yeni şifreleme Şifrelemesini ekledim. kodda görebileceğiniz gibiözel kimlik doğrulama ve parola şifreleme laravel 5

public function postLogin(Request $request) 
{ 
    $email = $request->get('email'); 
    $password = $this->hashPassword($request->get('password')); 
    $this->validate($request, [ 
     $this->loginUsername() => 'required', 'password' => 'required', 
    ]); 

    // 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 && $this->hasTooManyLoginAttempts($request)) { 
     return $this->sendLockoutResponse($request); 
    } 

    $credentials = ['email' => $email, 'password' => $this->hashPassword($password)]; 

    if (Auth::attempt(['email' => $email, 'password' => $this->hashPassword($password)])) { 
     // Authentication passed... 
     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) { 
     $this->incrementLoginAttempts($request); 
    } 

    return redirect($this->loginPath()) 
     ->withInput($request->only($this->loginUsername(), 'remember')) 
     ->withErrors([ 
      $this->loginUsername() => $this->getFailedLoginMessage(), 
     ]); 
} 

, ben function HashPassword aramış, çalışır, ama sorun benim veritabanında kullanıcıya sahip olmasına rağmen "Auth :: girişimi" ile, her zaman false döndürür olmasıdır doğru veriler.
Herhangi bir çözüm lütfen?
Çok teşekkürler böyle 'mypass' veya başka sth olarak 'şifre' dışında adı Tamam şifre alanını tutmak
Saygılarımızla

cevap

0

deneyin .. auth otomatik şifre anahtarı ile temin değeri sağlamalarının.

0

Bir çözüm buldum !!!
ben "login" ile "girişimi" olarak değiştirildi ve şimdi iyi çalışıyor: D
teşekkürler çocuklar

İlgili konular