Esempio n. 1
0
 public function editRow($sender, $param)
 {
     if ($this->IsValid) {
         $baseMethod = new BaseFunction();
         $qty = UserRecord::finder()->count();
         if (UserRecord::finder()->findByName($this->Login->getSafeText())) {
             $this->InCorrect->Visible = true;
         } else {
             $rows = new UserRecord();
             $rows->Username = $baseMethod->cryptString($this->Login->getSafeText());
             $rows->Email = $baseMethod->cryptString($this->Login->getSafeText());
             $rows->Password = $baseMethod->cryptString($this->Password->getSafeText());
             $rows->Role = 0;
             $rows->PagesID = $this->getRequest()->itemAt("id");
             $rows->Name = $this->Login->getSafeText();
             $rows->ID = $qty + 1;
             $rows->save();
             $this->Response->redirect($this->Service->constructUrl("User.Index", array("id" => $this->getRequest()->itemAt("id"))));
         }
     }
 }
Esempio n. 2
0
 public function changePassword2($sender, $param)
 {
     $finder = UserRecord::finder();
     $finder->DbConnection->Active = true;
     $transaction = $finder->DbConnection->beginTransaction();
     try {
         $baseMethod = new BaseFunction();
         $hash = $this->getRequest()->itemAt("amp;hash");
         if ($this->getRequest()->contains("amp;hash") == false) {
             $hash = $this->getRequest()->itemAt("hash");
         }
         $rows = $finder->findByUsername($hash);
         $rows->Password = TPropertyValue::ensureString($baseMethod->cryptString($this->ConfirmPassword->getSafeText()));
         $rows->save();
         $transaction->commit();
     } catch (Exception $e) {
         print_R($e->getMessage());
         $transaction->rollBack();
     }
     $this->Response->redirect($this->Service->constructUrl("Login"));
 }
Esempio n. 3
0
 public function validateUser($username, $password)
 {
     $baseMethod = new BaseFunction();
     return UserRecord::finder()->findBy_Username_AND_Password($baseMethod->cryptString($username), $baseMethod->cryptString($password));
 }
Esempio n. 4
0
 private function cryptPassword()
 {
     $baseMethod = new BaseFunction();
     return UserRecord::finder()->findByUsername_AND_Email($baseMethod->cryptString($this->Username->getSafeText()), $baseMethod->cryptString($this->Email->getSafeText()));
 }