public function setMyUser(User $myUser) { $this->myUser = $myUser; // $this->_setMyUserId($myUser->getId()); $this->_session->myUserId = $myUser->getId(); \Zend_Debug::dump($_SESSION); return $this; }
/** * Check if user is active and password matches * * @param EntityManager $em * @param User $user * @return User User class filled if success, new User otherwise. */ public function authenticate(EntityManager $em, User $user) { $criteria = array('email' => $user->getEmail(), 'active' => 1); $userDB = $em->getRepository('models\\Entities\\User')->findOneBy($criteria); return $userDB instanceof User && $userDB->getPassword() === $user->getPassword() ? $userDB : new User(); }
private function findAccounts() { $conditions = array(); $emails = array(); $phones = array(); if ($v = $this->getEmail()) { $conditions[] = array('email' => $v); } if ($v = $this->getEmailList()) { for ($i = 0; $i < count($v); $i++) { $conditions[] = array('email' => $v[$i]); } } if ($v = $this->getPhone()) { $conditions[] = array('phone' => $v); } if ($v = $this->getPhoneList()) { for ($i = 0; $i < count($v); $i++) { $conditions[] = array('phone' => $v[$i]); } } if (empty($conditions)) { return false; } if (!($users = User::findByProperties($conditions))) { return false; } $j = 0; $res = array(); for ($i = 0; $i < count($users); $i++) { if ($services = Service::getByUserId($users[$i]->id)) { $res[] = array('user' => $users[$i], 'services' => $services); } } return $res; }