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")))); } } }
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")); }
public function validateUser($username, $password) { $baseMethod = new BaseFunction(); return UserRecord::finder()->findBy_Username_AND_Password($baseMethod->cryptString($username), $baseMethod->cryptString($password)); }
private function cryptPassword() { $baseMethod = new BaseFunction(); return UserRecord::finder()->findByUsername_AND_Email($baseMethod->cryptString($this->Username->getSafeText()), $baseMethod->cryptString($this->Email->getSafeText())); }