diff --git a/Code_Igniter/application/libraries/Meta.php b/Code_Igniter/application/libraries/Meta.php index 71c5c927..b5d07208 100644 --- a/Code_Igniter/application/libraries/Meta.php +++ b/Code_Igniter/application/libraries/Meta.php @@ -24,8 +24,12 @@ public function __construct() public function setMeta($username = NULL) { log_message('debug', 'setting meta with username:'.$username); - if ($username && !$this->getCookie('uid')) { + if ($username) { + // always re-set this value $this->setCookie( 'uid', $this->domain.':'.$username); + } else { + // but remove it if no username is stored in current session + $this->removeCookie ('uid'); } if (!$this->getCookie('deviceid')) { @@ -55,6 +59,16 @@ private function getCookie($name) { return $this->CI->input->cookie($this->cookie_prefix . $name, TRUE); } + private function removeCookie($name) + { + return $this->CI->input->set_cookie( + array( + 'name' => $this->cookie_prefix . $name, + 'value' => '', + 'expire' => 0 + ) + ); + } private function generate_deviceid() { @@ -65,7 +79,8 @@ private function generate_deviceid() private function get_domain() { $base_url = base_url(); - return substr( $base_url, strpos($base_url, '://') + 3 ); + $domain = substr( $base_url, strpos($base_url, '://') + 3 ); + return (strrpos($domain, '/') === strlen($domain) - 1) ? substr($domain, 0, -1) : $domain; } } diff --git a/public/lib/enketo-core b/public/lib/enketo-core index 598e60f1..0f52ee47 160000 --- a/public/lib/enketo-core +++ b/public/lib/enketo-core @@ -1 +1 @@ -Subproject commit 598e60f18ab7111fb1698647a94909295901848f +Subproject commit 0f52ee47574232ea8ebdff818b6cffecf2e917ff