diff --git a/src/Illuminate/Auth/SessionGuard.php b/src/Illuminate/Auth/SessionGuard.php index 985b0bb4407c..8b388af1b9e5 100644 --- a/src/Illuminate/Auth/SessionGuard.php +++ b/src/Illuminate/Auth/SessionGuard.php @@ -566,7 +566,7 @@ public function login(AuthenticatableContract $user, $remember = false) } /** - * Update the session with the given ID. + * Update the session with the given ID and regenerate the session's token. * * @param string $id * @return void @@ -575,7 +575,7 @@ protected function updateSession($id) { $this->session->put($this->getName(), $id); - $this->session->migrate(true); + $this->session->regenerate(true); } /** diff --git a/tests/Auth/AuthGuardTest.php b/tests/Auth/AuthGuardTest.php index d7df6decea9d..ed2b8e97d5bf 100755 --- a/tests/Auth/AuthGuardTest.php +++ b/tests/Auth/AuthGuardTest.php @@ -158,7 +158,7 @@ public function testAttemptAndWithCallbacks() $mock->expects($this->once())->method('getName')->willReturn('foo'); $user->shouldReceive('getAuthIdentifier')->once()->andReturn('bar'); $mock->getSession()->shouldReceive('put')->with('foo', 'bar')->once(); - $session->shouldReceive('migrate')->once(); + $session->shouldReceive('regenerate')->once(); $mock->getProvider()->shouldReceive('retrieveByCredentials')->times(3)->with(['foo'])->andReturn($user); $mock->getProvider()->shouldReceive('validateCredentials')->twice()->andReturnTrue(); $mock->getProvider()->shouldReceive('validateCredentials')->once()->andReturnFalse(); @@ -233,7 +233,7 @@ public function testLoginStoresIdentifierInSession() $mock->expects($this->once())->method('getName')->willReturn('foo'); $user->shouldReceive('getAuthIdentifier')->once()->andReturn('bar'); $mock->getSession()->shouldReceive('put')->with('foo', 'bar')->once(); - $session->shouldReceive('migrate')->once(); + $session->shouldReceive('regenerate')->once(); $mock->login($user); } @@ -261,7 +261,7 @@ public function testLoginFiresLoginAndAuthenticatedEvents() $mock->expects($this->once())->method('getName')->willReturn('foo'); $user->shouldReceive('getAuthIdentifier')->once()->andReturn('bar'); $mock->getSession()->shouldReceive('put')->with('foo', 'bar')->once(); - $session->shouldReceive('migrate')->once(); + $session->shouldReceive('regenerate')->once(); $mock->login($user); } @@ -501,7 +501,7 @@ public function testLoginMethodQueuesCookieWhenRemembering() $cookie->shouldReceive('make')->once()->with($guard->getRecallerName(), 'foo|recaller|bar', 576000)->andReturn($foreverCookie); $cookie->shouldReceive('queue')->once()->with($foreverCookie); $guard->getSession()->shouldReceive('put')->once()->with($guard->getName(), 'foo'); - $session->shouldReceive('migrate')->once(); + $session->shouldReceive('regenerate')->once(); $user = m::mock(Authenticatable::class); $user->shouldReceive('getAuthIdentifier')->andReturn('foo'); $user->shouldReceive('getAuthPassword')->andReturn('bar'); @@ -521,7 +521,7 @@ public function testLoginMethodQueuesCookieWhenRememberingAndAllowsOverride() $cookie->shouldReceive('make')->once()->with($guard->getRecallerName(), 'foo|recaller|bar', 5000)->andReturn($foreverCookie); $cookie->shouldReceive('queue')->once()->with($foreverCookie); $guard->getSession()->shouldReceive('put')->once()->with($guard->getName(), 'foo'); - $session->shouldReceive('migrate')->once(); + $session->shouldReceive('regenerate')->once(); $user = m::mock(Authenticatable::class); $user->shouldReceive('getAuthIdentifier')->andReturn('foo'); $user->shouldReceive('getAuthPassword')->andReturn('bar'); @@ -540,7 +540,7 @@ public function testLoginMethodCreatesRememberTokenIfOneDoesntExist() $cookie->shouldReceive('make')->once()->andReturn($foreverCookie); $cookie->shouldReceive('queue')->once()->with($foreverCookie); $guard->getSession()->shouldReceive('put')->once()->with($guard->getName(), 'foo'); - $session->shouldReceive('migrate')->once(); + $session->shouldReceive('regenerate')->once(); $user = m::mock(Authenticatable::class); $user->shouldReceive('getAuthIdentifier')->andReturn('foo'); $user->shouldReceive('getAuthPassword')->andReturn('foo'); @@ -608,7 +608,7 @@ public function testUserUsesRememberCookieIfItExists() $guard->getProvider()->shouldReceive('retrieveByToken')->once()->with('id', 'recaller')->andReturn($user); $user->shouldReceive('getAuthIdentifier')->once()->andReturn('bar'); $guard->getSession()->shouldReceive('put')->with($guard->getName(), 'bar')->once(); - $session->shouldReceive('migrate')->once(); + $session->shouldReceive('regenerate')->once(); $this->assertSame($user, $guard->user()); $this->assertTrue($guard->viaRemember()); }