public function testUserRegister() { Bugdar::$auth = new AuthenticationTest(NULL); $data = new phalanx\base\PropertyBag(array('do' => 'submit', 'email' => '*****@*****.**', 'alias' => 'Robert', 'password' => 'abc123')); $event = new UserRegisterEvent($data); EventPump::Pump()->PostEvent($event); $user = new User($event->user_id()); $user->FetchInto(); $this->assertEquals($data->email, $user->email); $this->assertEquals($data->alias, $user->alias); $this->assertGreaterThanOrEqual(5, strlen($user->salt)); $this->assertEquals(md5(sha1($data->password) . $user->salt), $user->password); $this->assertGreaterThanOrEqual(5, strlen($user->authkey)); }
public function IsLoggedIn() { if ($this->current_user()) { return $this->current_user(); } $user = new User($_COOKIE['bugdar_user']); try { $user->FetchInto(); } catch (phalanx\data\ModelException $e) { return FALSE; } if ($user->authkey != $_COOKIE['bugdar_pass']) { return FALSE; } $this->current_user = $user; return $this->current_user; }
public function FetchReporter() { $user = new User($this->reporting_user_id); $user->FetchInto(); return $user; }
protected function _ValidateUser($value) { // Handle the default value. if ($this->required && empty($value) && !$this->default_value) { return array(FALSE, $value); } else { if ($this->default_value) { return array(TRUE, $this->default_value); } } // Look the user up by alias to get the user ID. $user = new User(); $user->alias = $value; $user->set_condition('alias = :alias'); try { $user->FetchInto(); return array(TRUE, $user->user_id); } catch (\phalanx\data\ModelException $e) { return array(FALSE, $value); } }