Example #1
0
 /**
  * @param $request
  * @param $session
  */
 protected function getRememberMeAdmin(Request $request, Session $session)
 {
     // try to get the remember me cookie
     $cookieAdminName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn');
     $cookie = $this->getRememberMeKeyFromCookie($request, $cookieAdminName);
     if (null !== $cookie) {
         // try to log
         $authenticator = new AdminTokenAuthenticator($cookie);
         try {
             // If have found a user, store it in the security context
             $user = $authenticator->getAuthentifiedUser();
             $session->setAdminUser($user);
             $this->applyUserLocale($user, $session);
             AdminLog::append("admin", "LOGIN", "Authentication successful", $request, $user, false);
         } catch (TokenAuthenticationException $ex) {
             AdminLog::append("admin", "LOGIN", "Token based authentication failed.", $request);
             // Clear the cookie
             $this->clearRememberMeCookie($cookieAdminName);
         }
     }
 }