/** * Test Get and Set Login Page * * @return void * * @covers \Rcm\Entity\Site */ public function testGetAndSetLoginPage() { $path = '/my/login'; $this->site->setLoginPage($path); $actual = $this->site->getLoginPage(); $this->assertEquals($path, $actual); }
/** * Process 401 Response Objects. This will redirect the visitor to the * sites configured login page. * * @return Response */ protected function processNotAuthorized() { $loginPage = $this->currentSite->getLoginPage(); $notAuthorized = $this->currentSite->getNotAuthorizedPage(); $returnToUrl = urlencode($this->request->getServer('REQUEST_URI')); $newResponse = new Response(); $newResponse->setStatusCode('302'); if (!$this->userService->hasIdentity()) { $newResponse->getHeaders()->addHeaderLine('Location: ' . $loginPage . '?redirect=' . $returnToUrl); } else { $newResponse->getHeaders()->addHeaderLine('Location: ' . $notAuthorized); } return $newResponse; }