* @param string $user | * @param string $user | ||||
*/ | */ | ||||
public function loggingInUsingWebAs($user) { | public function loggingInUsingWebAs($user) { | ||||
$loginUrl = substr($this->baseUrl, 0, -5); | |||||
$loginUrl = substr($this->baseUrl, 0, -5) . '/login'; | |||||
// Request a new session and extract CSRF token | // Request a new session and extract CSRF token | ||||
$client = new Client(); | $client = new Client(); | ||||
$response = $client->get( | $response = $client->get( |
} | } | ||||
/** | /** | ||||
* @NoCSRFRequired | |||||
* @PublicPage | * @PublicPage | ||||
* @UseSession | * @UseSession | ||||
* | * | ||||
} | } | ||||
} | } | ||||
if ($loginResult) { | if ($loginResult) { | ||||
return new RedirectResponse($this->urlGenerator->linkToRoute('login#showLoginForm')); | |||||
return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm')); | |||||
} | } | ||||
$this->userSession->createSessionToken($this->request, $user, $password); | $this->userSession->createSessionToken($this->request, $user, $password); | ||||
if (!is_null($redirect_url) && $this->userSession->isLoggedIn()) { | if (!is_null($redirect_url) && $this->userSession->isLoggedIn()) { |
<type>text</type> | <type>text</type> | ||||
<default></default> | <default></default> | ||||
<notnull>true</notnull> | <notnull>true</notnull> | ||||
<length>100</length> | |||||
<length>200</length> | |||||
</field> | </field> | ||||
<field> | <field> |
->will($this->returnValue(false)); | ->will($this->returnValue(false)); | ||||
$this->urlGenerator->expects($this->once()) | $this->urlGenerator->expects($this->once()) | ||||
->method('linkToRoute') | ->method('linkToRoute') | ||||
->with('login#showLoginForm') | |||||
->with('core.login.showLoginForm') | |||||
->will($this->returnValue($loginPageUrl)); | ->will($this->returnValue($loginPageUrl)); | ||||
$this->userSession->expects($this->never()) | $this->userSession->expects($this->never()) |
->will($this->returnValue(true)); | ->will($this->returnValue(true)); | ||||
$session->expects($this->at(2)) | $session->expects($this->at(2)) | ||||
->method('set') | ->method('set') | ||||
->with('last_login_check', time()); | |||||
->with('last_login_check', $this->equalTo(time(), 10)); | |||||
$session->expects($this->at(3)) | $session->expects($this->at(3)) | ||||
->method('get') | ->method('get') | ||||
->with($token); | ->with($token); | ||||
$session->expects($this->at(4)) | $session->expects($this->at(4)) | ||||
->method('set') | ->method('set') | ||||
->with('last_token_update', time()); | |||||
->with('last_token_update', $this->equalTo(time(), 10)); | |||||
$manager->expects($this->any()) | $manager->expects($this->any()) | ||||
->method('get') | ->method('get') |