public function setCookie($expiry = CookieAuthentication::DEF_EXPIRY) { // Set the cookie for autoauth for current user $ca = Cookies::getInstance(Cookies); if (User::isAuthenticated()) { $u = User::getActiveUser(); $name = config::get(CookieAuthentication::KEY_COOKIE_NAME, 'leptonauth'); $c = $this->encryptCookie(array('uid' => $u->userid, 'uname' => $u->username)); if ($expiry == -1) { $expiry = config::get(CookieAuthentication::KEY_COOKIE_EXPIRY, '7d'); } $ca->set($name, $c, array('expires' => $expiry, 'domain' => config::get(CookieAuthentication::KEY_COOKIE_DOMAIN, null), 'path' => '/')); } }