Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
enabled username/userID meta node support, #290
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnR committed Mar 28, 2014
1 parent 99e5842 commit 1058403
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions Code_Igniter/application/libraries/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@ public function __construct()

public function setMeta($username = NULL) {

//TODO: find more reliable way of passing username without issues
//for users that use multiple OpenRosa servers (and credentials).
//log_message('debug', 'setting meta with username:'.$username);
//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 ($username) {
// always re-set this value
$this->setCookie( 'uid', $this->domain.':'.$username);
} else {
// but remove it if no username is passed
$this->removeCookie ('uid');
}

if (!$this->getCookie('deviceid')) {
$this->setCookie('deviceid', $this->domain.':'.$this->generate_deviceid(), TRUE);
}

}

private function setCookie($name, $value, $expire_as_late_as_possible = FALSE )
Expand All @@ -61,6 +57,7 @@ private function getCookie($name)
{
return $this->CI->input->cookie($this->cookie_prefix . $name, TRUE);
}

private function removeCookie($name)
{
return $this->CI->input->set_cookie(
Expand Down
2 changes: 1 addition & 1 deletion public/lib/enketo-core

0 comments on commit 1058403

Please sign in to comment.