From 44149fc7916ab129e626441d2d81cd8ec7a8ec9f Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 15 Mar 2017 16:41:46 +0100 Subject: * activation on registration --- app/frontend/controls/RegistrationForm.php | 26 +++- app/frontend/controls/RegistrationForm.tpl | 185 +++++++++++++++++++---------- 2 files changed, 142 insertions(+), 69 deletions(-) (limited to 'app/frontend/controls') diff --git a/app/frontend/controls/RegistrationForm.php b/app/frontend/controls/RegistrationForm.php index 46494e3..0e6f740 100644 --- a/app/frontend/controls/RegistrationForm.php +++ b/app/frontend/controls/RegistrationForm.php @@ -6,8 +6,25 @@ Prado::using('Application.facades.UserFacade'); class RegistrationForm extends FacadeTemplateControl { + public function onLoad($param) { + parent::onLoad($param); + if ($this->Request['success'] === 'success') { + $this->MV->setActiveView($this->SuccessPanel); + } else { + $this->MV->setActiveView($this->FormPanel); + } + } + public function checkUsername($sender, $param) { - $param->IsValid = $this->getFacade()->checkForUsername($this->Login->SafeText); + $param->IsValid = $this->getFacade()->checkForUsername( + $this->Login->SafeText + ); + } + + public function checkEMail($sender, $param) { + $param->IsValid = $this->getFacade()->checkForEMail( + $this->EMail->SafeText + ); } public function registerUser($sender, $param) { @@ -15,10 +32,13 @@ class RegistrationForm extends FacadeTemplateControl { $this->getFacade()->registerUser( $this->Login->SafeText, $this->Password->Text, - $this->Admin->Checked + $this->EMail->Text ); $this->Response->redirect( - $this->Service->constructUrl(NULL) + $this->Service->constructUrl( + $this->Request->ServiceParameter, + ['success' => 'success'] + ) ); } } diff --git a/app/frontend/controls/RegistrationForm.tpl b/app/frontend/controls/RegistrationForm.tpl index 9defe54..0c7e146 100644 --- a/app/frontend/controls/RegistrationForm.tpl +++ b/app/frontend/controls/RegistrationForm.tpl @@ -1,66 +1,119 @@ -<%[ Username: ]%> - - - <%[ Username cannot be empty ]%> - - - <%[ Username must contain 6-255 characters, all Latin alphanumeric or underscore ]%> - - - <%[ Username already exists ]%> - -
-<%[ Password: ]%> - - - <%[ Password cannot be empty ]%> - -
-<%[ Repeat password: ]%> - - - <%[ Password cannot be empty ]%> - - - <%[ Passwords don't match ]%> - -
-<%[ Admin: ]%> - -
- - <%[ Create ]%> - - + + + <%[ Username: ]%> + + + <%[ Username cannot be empty ]%> + + + <%[ Username must contain 6-255 characters, all Latin alphanumeric or underscore ]%> + + + <%[ Username already exists ]%> + +
+ <%[ Password: ]%> + + + <%[ Password cannot be empty ]%> + +
+ <%[ Repeat password: ]%> + + + <%[ Password cannot be empty ]%> + + + <%[ Passwords don't match ]%> + +
+ <%[ E-mail: ]%> + + + <%[ E-mail address cannot be empty ]%> + + + <%[ E-mail address is invalid ]%> + + + <%[ E-mail already registered ]%> + +
+ <%[ Repeat e-mail: ]%> + + + <%[ E-mail address cannot be empty ]%> + + + <%[ E-mail address is invalid ]%> + + + <%[ E-mails don't match ]%> + +
+ + <%[ Create ]%> + + +
+ + <%[ Registration finished without problems. Please activate your account with the link we've sent you. ]%> + +
-- cgit v1.2.3