Ejemplo n.º 1
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $fields = array("email" => $request->getParam('email', ""));
     /**
      * a post action has occured, validate data
      */
     if ($request->isPost()) {
         $hasError = false;
         $email = trim($request->getPost('email', ""));
         $fields["email"] = $email;
         if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
             $hasError = true;
             $fields["email_error"] = "Not a valid email.";
         }
         $password = $request->getPost('password', "");
         $fields["password"] = "";
         if (strlen($password) < 4) {
             $hasError = true;
             $fields["password_error"] = "Password must be at least 4 characters!";
         }
         if (!$hasError) {
             $member = new Application_Model_Users();
             if ($member->exists($email)) {
                 $user = $member->getUser($email);
                 $sha = new Application_Model_NanoSha256();
                 if ($sha->getSaltedHash($email, $password) == $user->pass) {
                     $groups = array(99 => "Physician", 59 => "Family Member", 10 => "Patient");
                     $authNamespace = new Zend_Session_Namespace('Zend_Auth');
                     $authNamespace->id = $user->id;
                     $authNamespace->email = $user->email;
                     $authNamespace->name_first = $user->name_first;
                     $authNamespace->name_last = $user->name_last;
                     $authNamespace->account_type = $user->account_type;
                     $authNamespace->name = $user['name_first'] . " " . $user['name_last'];
                     $authNamespace->title_name = $user->title . " " . $authNamespace->name;
                     $authNamespace->account_type_print = $groups[$user->account_type];
                     $authNamespace->relationship = $user->relationship;
                     return $this->_redirect('/portal');
                 } else {
                     $hasError = true;
                     $fields["error"] = "Invalid email/password combination!";
                 }
             } else {
                 $hasError = true;
                 $fields["error"] = "Invalid email/password combination!";
             }
         }
         if ($hasError) {
             $fields["has_error"] = true;
         }
         $this->view->fields = $fields;
     }
 }
Ejemplo n.º 2
0
 public function settings(Application_Model_Users $user)
 {
     $data = array('user' => $user->getUser(), 'key' => base64_encode($user->getKey()), 'secret' => base64_encode($user->getSecret()), 'cid' => $user->getCid());
     $this->getDbTable()->update($data, array('user = ?' => $user->getUser()));
 }
Ejemplo n.º 3
0
 private function projectMembersByType($project_id, $type)
 {
     $project_team = Application_Model_Projects::getProjectTeam($project_id);
     $project_team[] = Application_Model_Users::getUser(ProNav_Auth::getUserID());
     $project_team = array_unique($project_team);
     $to_users = array();
     $from_users = array();
     foreach ($project_team as $user) {
         $u = new stdClass();
         $u->user_id = $user->user_id;
         $u->name = $user->getFormattedName(Application_Model_User::LFMI);
         if ($user->corporation_id == ProNav_Utils::TriMId) {
             $from_users[] = $u;
         } else {
             $to_users[] = $u;
         }
     }
     if ($type == 1) {
         return $from_users;
     } else {
         return $to_users;
     }
 }