Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Illuminate/Auth/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -575,7 +575,7 @@ protected function updateSession($id)
{
$this->session->put($this->getName(), $id);

$this->session->migrate(true);
$this->session->regenerate(true);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/Auth/AuthGuardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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());
}
Expand Down