Example #1
0
 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));
 }
Example #2
0
 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;
 }
Example #3
0
 public function FetchReporter()
 {
     $user = new User($this->reporting_user_id);
     $user->FetchInto();
     return $user;
 }
Example #4
0
 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);
     }
 }