예제 #1
0
 /**
  * Convert an object user to an associative array
  *
  * @param \Entity\User $entity The object user
  *
  * @return array The associative array
  */
 protected function convertObjectToArray($entity)
 {
     $data = array();
     $data['id'] = $entity->getId();
     $data['password'] = $entity->getPassword();
     $data['username'] = $entity->getUsername();
     return $data;
 }
예제 #2
0
 /**
  * 
  * @param \Entity\User $user
  */
 public function update($user)
 {
     //password
     if (strlen($user->getPassword()) > 0) {
         $sql = 'UPDATE user SET name=:name, email=:email, password=:password, active=:active, `group`=:group WHERE user_id=:id';
     }
     // no password
     if (strlen($user->getPassword()) < 1) {
         $sql = 'UPDATE user SET name=:name, email=:email, active=:active, `group`=:group WHERE user_id=:id';
     }
     $stmt = $this->db->getConnection()->prepare($sql);
     // password
     if (strlen($user->getPassword()) > 0) {
         $stmt->bindParam('password', $user->getPassword());
     }
     $stmt->bindParam('name', $user->getName());
     $stmt->bindParam('email', $user->getEmail());
     $stmt->bindParam('active', $user->getActive());
     $stmt->bindParam('group', $user->getGroup());
     $stmt->bindParam('id', $user->getUserId());
     return $stmt->execute();
 }
 /**
  * {@inheritDoc}
  */
 public function getPassword()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPassword', []);
     return parent::getPassword();
 }
 public function getPassword()
 {
     $this->__load();
     return parent::getPassword();
 }
예제 #5
0
 /**
  * Test whether a given plain text password matches a given User's encoded password.
  *
  * @param User $user
  * @param string $password
  * @return bool
  */
 public function checkUserPassword(User $user, $password)
 {
     return $user->getPassword() === $this->encodeUserPassword($user, $password);
 }