コード例 #1
0
 public function execute(LoggerInterface $log)
 {
     RememberMeService::instance()->clearExpiredRememberMe();
     $expiredSubscriptionCount = SubscriptionsService::instance()->expiredSubscriptions();
     $log->debug(sprintf('Expired (%s)', $expiredSubscriptionCount));
 }
コード例 #2
0
 /**
  * Clear the local rememberme cookie
  *
  * @param int $userId
  */
 public function clearRememberMe($userId)
 {
     $cookie = $this->getRememberMeCookie();
     if (!empty($cookie)) {
         $rememberMeService = RememberMeService::instance();
         $rememberMeService->deleteRememberMe($userId, $cookie['token'], 'rememberme');
     }
     $this->clearRememberMeCookie();
 }
コード例 #3
0
ファイル: RememberMe.php プロジェクト: TonyWoo/website
 function execute()
 {
     RememberMeService::instance()->clearExpiredRememberMe();
 }
コード例 #4
0
 /**
  * Returns the remember me record for the current cookie
  *
  * @return array
  */
 protected function getRememberMe()
 {
     $rememberMeService = RememberMeService::instance();
     $cookie = Session::instance()->getRememberMeCookie();
     $token = $cookie->getValue();
     $rememberMe = null;
     // throw back to when I used a json string in the rememberme cookie
     // this is here so no-ones remember me cookie failed after upgrade.
     if (!empty($token) && $token[0] == "{") {
         $cookieData = @json_decode($token, true);
         if (!empty($cookieData) && isset($cookieData['token'])) {
             $token = $cookieData['token'];
         }
     }
     // If the token is not empty query the DB for the remember me record
     if (!empty($token)) {
         $rememberMe = $rememberMeService->getRememberMe($token, 'rememberme');
     }
     return $rememberMe;
 }
コード例 #5
0
ファイル: index.php プロジェクト: noremac13/website
use Destiny\Common\Session;
use Destiny\Common\Config;
use Destiny\Common\Routing\Router;
use Destiny\Common\Routing\RouteAnnotationClassLoader;
use Destiny\Common\DirectoryClassIterator;
use Destiny\Common\Authentication\RememberMeService;
use Destiny\Common\Authentication\AuthenticationService;
use Doctrine\Common\Annotations\FileCacheReader;
use Doctrine\Common\Annotations\AnnotationReader;
use Destiny\Common\Request;
ini_set('session.gc_maxlifetime', 5 * 60 * 60);
$context = new \stdClass();
$context->log = 'web';
require __DIR__ . '/../lib/boot.php';
$app = Application::instance();
$app->setRouter(new Router());
$app->setAnnotationReader(new FileCacheReader(new AnnotationReader(), realpath(Config::$a['cache']['path']) . '/annotation/'));
// Annotation reader and routing
RouteAnnotationClassLoader::loadClasses(new DirectoryClassIterator(_BASEDIR . '/lib/', 'Destiny/Controllers/'), $app->getAnnotationReader());
// Setup user session
$session = new SessionInstance();
$session->setSessionCookie(new SessionCookie(Config::$a['cookie']));
$session->setCredentials(new SessionCredentials());
$app->setSession($session);
// Start the session if a valid session cookie is found
Session::start(Session::START_IFCOOKIE);
// Startup the remember me and auth service
AuthenticationService::instance()->init();
RememberMeService::instance()->init();
// Attempts to find a route and execute it
$app->executeRequest(new Request());