예제 #1
0
파일: doctor.php 프로젝트: HLitmus/WebApp
 /**
  * Verifies the doctor and allows them to change or create password
  * @before _session
  */
 public function verify($id)
 {
     $this->seo(array("title" => "Thanks for Registering", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $meta = Meta::first(array("value = ?" => $id, "property = ?" => "forgotPass"));
     if (!$meta) {
         $this->redirect("/404");
     }
     $user = User::first(array("id = ?" => $meta->user_id));
     if ($user) {
         $view->set("message", "Please create a password");
     } else {
         $this->redirect("/");
     }
     if (RequestMethods::post("action") == "setpass") {
         if (!$user->validate()) {
             $view->set("message", "Fields are required");
             return;
         }
         if (RequestMethods::post("password") == RequestMethods::post("rpassword")) {
             $user->password = sha1(RequestMethods::post("password"));
             $user->live = 1;
             $user->save();
             $this->setUser($user);
             $doctor = Doc::first(array("user_id = ?" => $user->id));
             $member = Member::first(array("user_id = ?" => $this->user->id));
             $organization = Organization::first(array("id = ?" => $member->organization_id));
             Registry::get("session")->set("doctor", $doctor)->set("member", $member)->set("organization", $organization);
             $meta->delete();
             $this->redirect("/doctor");
         } else {
             $view->set("message", "Password doesnot match");
         }
     }
 }
예제 #2
0
파일: auth.php 프로젝트: HLitmus/WebApp
 protected function session()
 {
     $session = Registry::get("session");
     $managers = Manager::all(array("user_id = ?" => $this->user->id));
     if ($managers) {
         $session->set("managing", $managers);
         $this->redirect("/admin");
     }
     $member = Member::first(array("user_id = ?" => $this->user->id));
     $doc = Doc::first(array("user_id = ?" => $this->user->id));
     if ($member && !$doc) {
         $organization = Organization::first(array("id = ?" => $member->organization_id));
         $session->set("member", $member);
         $session->set("organization", $organization);
         $this->redirect("/vendor");
     }
     if ($doc && $member) {
         $organization = Organization::first(array("id = ?" => $member->organization_id));
         $session->set("member", $member);
         $session->set("organization", $organization);
         $session->set("doctor", $doc);
         $this->redirect("/doctor");
     }
     $checkout = isset($_COOKIE["__hlCheckout"]) ? true : false;
     if ($checkout) {
         setcookie("__hlCheckout", "", time() - 3600);
         $this->redirect("/cart/checkout");
     }
     $this->redirect("/patient.html");
 }