/** * Default action with registration form. * * @access public * @return View * @since 1.0.0 * @version 2.1.0-dev */ public function actionDefault() { // if user is logged, redirect to main page if (UserModel::isLogged()) { Route::factory('home')->redirectTo(); } $this->setTitle(__('Register Your account')); $this->setKeywords(__('register account,login,email,password')); /* @var $oConfig ModelFormConfig */ $oConfig = ModelFormConfig::factory(); $oConfig->noReload(); $oConfig->setFieldsRestriction(['login', 'email', 'password']); $oUser = new UserModel(); $oModelForm = $oUser->form('register', $oConfig); /* @var $oModelForm \ModelForm\User */ $oForm = $oModelForm->generate(); // if form is submitted and is valid if ($oForm->isSubmittedAndValid()) { $this->sendActivationCode($oForm->get('password_confirm'), $oUser); $sMessage = __('Your account has been registered successfully. Activation link has been sent to your mailbox. Click it to make the final activation.'); Session::flash(Router::getCurrentUrl(), $sMessage); } // return registration View return View::factory('user/frontend/register')->bind('oForm', $oForm); }