diff --git a/src/Illuminate/Auth/SessionGuard.php b/src/Illuminate/Auth/SessionGuard.php index 7966eaa7da12..a88e213dbb5c 100644 --- a/src/Illuminate/Auth/SessionGuard.php +++ b/src/Illuminate/Auth/SessionGuard.php @@ -253,6 +253,8 @@ public function once(array $credentials = []) $this->fireAttemptEvent($credentials); if ($this->validate($credentials)) { + $this->rehashPasswordIfRequired($this->lastAttempted, $credentials); + $this->setUser($this->lastAttempted); return true; diff --git a/tests/Auth/AuthGuardTest.php b/tests/Auth/AuthGuardTest.php index e75efd642c37..d7df6decea9d 100755 --- a/tests/Auth/AuthGuardTest.php +++ b/tests/Auth/AuthGuardTest.php @@ -623,6 +623,7 @@ public function testLoginOnceSetsUser() }); $guard->getProvider()->shouldReceive('retrieveByCredentials')->once()->with(['foo'])->andReturn($user); $guard->getProvider()->shouldReceive('validateCredentials')->once()->with($user, ['foo'])->andReturn(true); + $guard->getProvider()->shouldReceive('rehashPasswordIfRequired')->with($user, ['foo'])->once(); $guard->shouldReceive('setUser')->once()->with($user); $this->assertTrue($guard->once(['foo'])); } @@ -637,6 +638,7 @@ public function testLoginOnceFailure() }); $guard->getProvider()->shouldReceive('retrieveByCredentials')->once()->with(['foo'])->andReturn($user); $guard->getProvider()->shouldReceive('validateCredentials')->once()->with($user, ['foo'])->andReturn(false); + $guard->getProvider()->shouldNotReceive('rehashPasswordIfRequired'); $this->assertFalse($guard->once(['foo'])); }