/** * Check whether the session is expired * * @return bool */ public function isSessionExpired() { $lifetime = $this->securityConfig->getAdminSessionLifetime(); $currentTime = $this->securityConfig->getCurrentTimestamp(); $lastUpdatedTime = $this->getUpdatedAt(); if (!is_numeric($lastUpdatedTime)) { $lastUpdatedTime = strtotime($lastUpdatedTime); } return $lastUpdatedTime <= $currentTime - $lifetime ? true : false; }
/** * Clean expired Admin Sessions * * @return $this */ public function cleanExpiredRecords() { $this->passwordResetRequestEventCollectionFactory->create()->deleteRecordsOlderThen($this->securityConfig->getCurrentTimestamp() - self::SECURITY_CONTROL_RECORDS_LIFE_TIME); return $this; }
/** * Filter expired sessions * * @param int $sessionLifeTime * @return $this */ public function filterExpiredSessions($sessionLifeTime) { $this->addFieldToFilter('updated_at', ['gt' => $this->dateTime->formatDate($this->securityConfig->getCurrentTimestamp() - $sessionLifeTime)]); return $this; }
/** * Clean expired Admin Sessions * * @return $this */ public function cleanExpiredSessions() { $this->createAdminSessionInfoCollection()->deleteSessionsOlderThen($this->securityConfig->getCurrentTimestamp() - self::ADMIN_SESSION_LIFETIME); return $this; }
/** * @return void */ public function testGetCurrentTimestamp() { $this->assertEquals(true, is_int($this->helper->getCurrentTimestamp())); }
/** * Filter by lifetime * * @param int $lifetime * @return $this */ public function filterByLifetime($lifetime) { $this->addFieldToFilter('created_at', ['gt' => $this->dateTime->formatDate($this->securityConfig->getCurrentTimestamp() - $lifetime)]); return $this; }