/** * Before execute login * * @param Login $login * @return void */ public function beforeExecute(Login $login) { $logoutReasonCode = $this->securityCookie->getLogoutReasonCookie(); if ($this->isLoginForm($login) && $logoutReasonCode >= 0) { $this->messageManager->addError($this->sessionsManager->getLogoutReasonMessageByStatus($logoutReasonCode)); $this->securityCookie->deleteLogoutReasonCookie(); } }
/** * Test delete logout reason cookie * @return void */ public function testDeleteLogoutReasonCookie() { $frontName = 'FrontName'; $this->createCookieMetaData(); $this->backendDataMock->expects($this->once())->method('getAreaFrontName')->willReturn($frontName); $this->cookieMetadataMock->expects($this->once())->method('setPath')->with('/' . $frontName)->willReturnSelf(); $this->cookieMetadataMock->expects($this->once())->method('setDuration')->with(-1)->willReturnSelf(); $this->phpCookieManagerMock->expects($this->once())->method('setPublicCookie')->with(SecurityCookie::LOGOUT_REASON_CODE_COOKIE_NAME, '', $this->cookieMetadataMock)->willReturnSelf(); $this->assertEquals($this->model, $this->model->deleteLogoutReasonCookie()); }