summaryrefslogtreecommitdiff
path: root/app/php/controls/RegistrationForm.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-06 15:40:50 +0200
committeremkael <emkael@tlen.pl>2016-05-06 15:40:50 +0200
commita43e887c380fc414121792658136a34051526b6a (patch)
tree1816ec713671d02dd3d24e92c2f4675f7deab30d /app/php/controls/RegistrationForm.php
parent5bfe174b5907440a4f08bd45fd9c384ab5c58037 (diff)
* DbUser refactored to use a facade
Diffstat (limited to 'app/php/controls/RegistrationForm.php')
-rw-r--r--app/php/controls/RegistrationForm.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/php/controls/RegistrationForm.php b/app/php/controls/RegistrationForm.php
index d88fb95..46494e3 100644
--- a/app/php/controls/RegistrationForm.php
+++ b/app/php/controls/RegistrationForm.php
@@ -2,21 +2,21 @@
Prado::using('Application.web.FacadeTemplateControl');
-Prado::using('Application.model.User');
+Prado::using('Application.facades.UserFacade');
class RegistrationForm extends FacadeTemplateControl {
public function checkUsername($sender, $param) {
- $param->IsValid = !User::finder()->countByLogin($this->Login->SafeText);
+ $param->IsValid = $this->getFacade()->checkForUsername($this->Login->SafeText);
}
public function registerUser($sender, $param) {
if ($this->Page->IsValid) {
- $newUser = new User();
- $newUser->Login = $this->Login->SafeText;
- $newUser->Password = DbUser::generatePassword($this->Password->Text);
- $newUser->IsAdmin = $this->Admin->Checked;
- $newUser->save();
+ $this->getFacade()->registerUser(
+ $this->Login->SafeText,
+ $this->Password->Text,
+ $this->Admin->Checked
+ );
$this->Response->redirect(
$this->Service->constructUrl(NULL)
);