本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::invalidate方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::invalidate方法的具体用法?PHP SessionInterface::invalidate怎么用?PHP SessionInterface::invalidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::invalidate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
/**
* Logs the current user out.
*
* @return Response
*/
public function logout()
{
$this->events->dispatch(AuthEvents::LOGOUT, $event = new LogoutEvent($this->user));
$this->user = null;
$this->session->invalidate();
return $event->getResponse();
}
示例2: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$clientBaseURL = $session->get('client/base_url');
$this->getLogger()->addInfo('LOG OUT', $this->getLoggerContext());
$session->invalidate();
return new RedirectResponse($clientBaseURL);
}
示例3: logout
/**
* Logs the current user out.
*
* @return Response
*/
public function logout()
{
$event = $this->events->trigger(new LogoutEvent(AuthEvents::LOGOUT, $this->user));
$this->user = null;
$this->session->invalidate();
return $event->getResponse();
}
示例4: logout
/**
* Logout user session
*
* @return void
*/
public function logout()
{
$this->set('user.id', null);
$this->set('user.role', null);
$this->set('user.locale', null);
// Clears all session data and regenerates session ID
$this->session->invalidate();
}
示例5: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$date = Util::getServerCurrentDateTime();
$this->getLogger()->addInfo('LOG OUT', $this->getLoggerContext());
// Unset all of the session variables.
$session->invalidate();
// also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
}
// Finally, destroy the session.
session_destroy();
return new RedirectResponse($session->get('client/base_url') . '/helpdesk/customer-portal');
}
示例6: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$content = 'Signin.php';
$signInError = null;
$httpHOST = $_SERVER['SERVER_NAME'];
$httpHOST = Util::getHttpHost();
$clientSettings = $this->getRepository(UbirimiClient::class)->getSettingsByBaseURL($httpHOST);
$clientId = $clientSettings['id'];
$client = $this->getRepository(UbirimiClient::class)->getById($clientId);
if ($session->has('user') && Util::getSubdomain() == $session->get('client/company_domain')) {
return new RedirectResponse($httpHOST . '/yongo/my-dashboard');
}
$context = $request->get('context');
if ($request->request->has('sign_in')) {
$username = $request->request->get('username');
$password = $request->request->get('password');
$userData = $this->getRepository(UbirimiUser::class)->getByUsernameAndClientId($username, $clientId);
if ($userData['id']) {
if (UbirimiContainer::get()['password']->check($password, $userData['password'])) {
$session->invalidate();
$clientId = $userData['client_id'];
UbirimiContainer::get()['warmup']->warmUpClient($userData, true, true);
UbirimiContainer::get()['login.time']->userSaveLoginTime($userData['id']);
$date = Util::getServerCurrentDateTime();
$this->getLogger()->addInfo('LOG IN', $this->getLoggerContext());
if ($context) {
return new RedirectResponse($httpHOST . $context);
} else {
return new RedirectResponse($httpHOST . '/yongo/my-dashboard');
}
} else {
$signInError = true;
}
} else {
$signInError = true;
}
} else {
if ($request->request->has('create_account')) {
return new RedirectResponse('/sign-up');
}
}
return $this->render(__DIR__ . '/../Resources/views/_main.php', get_defined_vars());
}
示例7: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$signInError = null;
$httpHOST = Util::getHttpHost();
$clientSettings = $this->getRepository(UbirimiClient::class)->getSettingsByBaseURL($httpHOST);
$clientId = $clientSettings['id'];
if ($session->has('user') && Util::getSubdomain() == $session->get('client/company_domain')) {
return new RedirectResponse($httpHOST . '/helpdesk/customer-portal/dashboard');
}
if ($request->request->has('sign_in')) {
$username = $request->request->get('username');
$password = $request->request->get('password');
$userData = $this->getRepository(UbirimiUser::class)->getCustomerByEmailAddressAndClientId($username, $clientId);
if ($userData['id']) {
if (UbirimiContainer::get()['password']->check($password, $userData['password'])) {
$session->invalidate();
UbirimiContainer::get()['warmup']->warmUpCustomer($userData);
return new RedirectResponse($httpHOST . '/helpdesk/customer-portal/dashboard');
} else {
$signInError = true;
}
} else {
$signInError = true;
}
if ($signInError) {
return new RedirectResponse('/helpdesk/customer-portal');
}
} else {
if ($request->request->has('create_account')) {
return new RedirectResponse('/helpdesk/customer-portal/sign-up');
} else {
if ($request->request->has('get_password')) {
return new RedirectResponse('/helpdesk/customer-portal/get-password');
}
}
}
}
示例8: testInvalidate
public function testInvalidate()
{
$this->session->set('invalidate', 123);
$this->session->invalidate();
$this->assertEquals(array(), $this->session->all());
}
示例9: invaliateSession
private function invaliateSession()
{
$this->session->invalidate();
}
示例10: invalidateSession
/**
* @param SessionInterface $session
* @param Request $request
*/
private function invalidateSession(SessionInterface $session, Request $request)
{
$session->invalidate();
$session->set('kuma_ip', $this->getIp($request));
$session->set('kuma_ua', $this->getUserAgent($request));
}
示例11: logout
public function logout()
{
$this->session->invalidate();
}
示例12: logOut
/**
* @param SessionInterface $session
*/
public function logOut(SessionInterface $session)
{
$session->invalidate();
}
示例13: sess_destroy
/**
* Destroy the current session
*/
public function sess_destroy()
{
$this->session->invalidate();
}