/** * @return bool * @throws \Exception */ public function validateForm() { $validateMail = new Email(); $validateUsername = new Username(); $validatePassword = new Password(); if (Cunity::get("settings")->getSetting("register.min_age")) { $validateBirthday = new Zend_Validate_Date(["format" => "mm/dd/yyyy"]); if (!$validateBirthday->isValid($_POST['birthday'])) { $this->errors['birthday'] = implode(',', $validateBirthday->getMessages()); } } if (!$validateUsername->isValid($_POST['username'])) { $this->errors["username"] = implode(',', $validateUsername->getMessages()); } if (!$validateMail->isValid($_POST['email'])) { $this->errors["email"] = implode(',', $validateMail->getMessages()); } if (!$validatePassword->passwordValid($_POST['password'], $_POST['password_repeat'])) { $this->errors["password"] = implode(',', $validatePassword->getMessages()); $this->errors["password_repeat"] = ""; } return empty($this->errors); }
/** * @param Username $validateUsername */ private function getUserName(Username $validateUsername) { if ($validateUsername->isValid($_POST['username'])) { $this->user->username = $_POST['username']; } else { $this->message[] = implode(",", $validateUsername->getMessages()); } }