diff options
Diffstat (limited to 'app/php/controls/RegistrationForm.php')
-rw-r--r-- | app/php/controls/RegistrationForm.php | 14 |
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) ); |