to control develop env do not use session
Showing
1 changed file
with
8 additions
and
9 deletions
@@ -302,20 +302,19 @@ class AbstractAction extends Controller_Abstract | @@ -302,20 +302,19 @@ class AbstractAction extends Controller_Abstract | ||
302 | if (!$this->_uid) { | 302 | if (!$this->_uid) { |
303 | $cookie = $this->getCookie('_UID'); | 303 | $cookie = $this->getCookie('_UID'); |
304 | if (!empty($cookie)) { | 304 | if (!empty($cookie)) { |
305 | - $uid = 0; | ||
306 | $cookieList = explode('::', $cookie); | 305 | $cookieList = explode('::', $cookie); |
307 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { | 306 | if (isset($cookieList[1]) && is_numeric($cookieList[1])) { |
308 | - $uid = $cookieList[1]; | 307 | + if ($useSession) { |
308 | + $token = $this->getSession('_TOKEN'); | ||
309 | + if ($token === Helpers::makeToken($cookieList[1])) { | ||
310 | + $this->_uid = $cookieList[1]; | ||
311 | + } | ||
312 | + } else { | ||
313 | + $this->_uid = $cookieList[1]; | ||
314 | + } | ||
309 | $this->_uname = $cookieList[0]; | 315 | $this->_uname = $cookieList[0]; |
310 | $this->_vip = $cookieList[2]; | 316 | $this->_vip = $cookieList[2]; |
311 | } | 317 | } |
312 | - // 服务端比较 | ||
313 | - if ($useSession && $uid) { | ||
314 | - $token = $this->getSession('_TOKEN'); | ||
315 | - if ($token === Helpers::makeToken($uid)) { | ||
316 | - $this->_uid = $uid; | ||
317 | - } | ||
318 | - } | ||
319 | } | 318 | } |
320 | } | 319 | } |
321 | return $this->_uid; | 320 | return $this->_uid; |
-
Please register or login to post a comment