Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/constants/PhabricatorCookies.php
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | /* -( Client ID Cookie )--------------------------------------------------- */ | ||||
public static function setClientIDCookie(AphrontRequest $request) { | public static function setClientIDCookie(AphrontRequest $request) { | ||||
// NOTE: See T3471 for some discussion. Some browsers and browser extensions | // NOTE: See T3471 for some discussion. Some browsers and browser extensions | ||||
// can make duplicate requests, so we overwrite this cookie only if it is | // can make duplicate requests, so we overwrite this cookie only if it is | ||||
// not present in the request. The cookie lifetime is limited by making it | // not present in the request. The cookie lifetime is limited by making it | ||||
// temporary and clearing it when users log out. | // temporary and clearing it when users log out. | ||||
$value = $request->getCookie(self::COOKIE_CLIENTID); | $value = $request->getCookie(self::COOKIE_CLIENTID); | ||||
if (!strlen($value)) { | if (!phutil_nonempty_string($value)) { | ||||
$request->setTemporaryCookie( | $request->setTemporaryCookie( | ||||
self::COOKIE_CLIENTID, | self::COOKIE_CLIENTID, | ||||
Filesystem::readRandomCharacters(16)); | Filesystem::readRandomCharacters(16)); | ||||
} | } | ||||
} | } | ||||
/* -( Next URI Cookie )---------------------------------------------------- */ | /* -( Next URI Cookie )---------------------------------------------------- */ | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0