Wpis z mikrobloga

#symfony #symfony2 #php
Chcę w Symfony2 się zabezpieczyć przed multi logowaniem. Ma wylogować poprzednią sesję jeśli się nowy zaloguje. Ktoś z was już rozwiązał taki problem?
Sesję trzymam w memcache, mam jeszcze redisa do wykorzystania.
  • 12
  • Odpowiedz
  • Otrzymuj powiadomienia
    o nowych komentarzach

@Harry19911: to nie wiem w tej chwili, mozesz mi podeslac kod/klase?
Dokumentacja, w przypadku timeoutu np.: radzi cos takiego:

This metadata can be used to explicitly expire a session on access, e.g.:
$session->start();
if (time() - $session->getMetadataBag()->getLastUsed() >
  • Odpowiedz
@Harry19911: @Cilthal:
`public Boolean invalidate(integer $lifetime = null)
Invalidates the current session.
Clears all session attributes and flashes and regenerates the session and deletes the old session from persistence.
Parameters
integer $lifetime Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and
  • Odpowiedz
@Cilthal: Ale problem z Cannot change the ID... jest przy próbie setId, nie przy invalidate. Spróbowałem też czegoś takiego:

$sessionOld = $event->getRequest()->getSession();
$oldId = $sessionOld->getId();
  • Odpowiedz