public function registerAction(Request $request) { $registerForm = new RegisterModel($request); if ($request->isPost()) { if ($registerForm->isValid()) { if ($registerForm->usernameValid()) { if ($registerForm->passwordStrong()) { if ($registerForm->isUserExist()) { $registerForm->insertIntoDB(); Session::setFlash(__t('successfully_logged')); $this->redirect("/"); } else { Session::setFlash(__t('user_already_exists')); } } else { Session::setFlash(__t('password_not_strong')); } } else { Session::setFlash(__t('invalid_login')); } } else { Session::setFlash($registerForm->passwordMath() ? __t('fill_fields') : __t('passwords_dont_match')); } } $args = array('registerForm' => $registerForm); return $this->render($args); }