function test_IsValidEmail() { $this->assertTrue(Util::isValidEmail(self::EMAIL_OK)); $this->assertTrue(!Util::isValidEmail(self::EMAIL_NOK_1)); $this->assertTrue(!Util::isValidEmail(self::EMAIL_NOK_2)); $this->assertTrue(!Util::isValidEmail(self::EMAIL_NOK_3)); $this->assertTrue(!Util::isValidEmail(self::EMAIL_NOK_4)); $this->assertTrue(!Util::isValidEmail(self::EMAIL_NOK_5)); }
/** * Confirm New user * */ protected function CreateNewUserConfirm() { if (!$this->_login->getCanRegister()) { $this->FormLogin(); return; } $myWords = $this->WordCollection(); $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert); $container->setAutoHide(5000); $this->_blockCenter->addXmlnukeObject($container); if ($this->_login->getName() == "" || $this->_login->getEmail() == "" || $this->_login->getUsername() == "" || !Util::isValidEmail($this->_login->getEmail())) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("INCOMPLETEDATA"), true)); $this->CreateNewUser(); } elseif (!XmlInputImageValidate::validateText($this->_context)) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("OBJECTIMAGEINVALID"), true)); $this->CreateNewUser(); } else { $newpassword = $this->getRandomPassword(); if (!$this->_users->addUser($this->_login->getName(), $this->_login->getUsername(), $this->_login->getEmail(), $newpassword)) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSERFAIL"), true)); $this->CreateNewUser(); } else { $this->sendWelcomeMessage($myWords, $this->_context->get("name"), $this->_context->get("newloguser"), $this->_context->get("email"), $newpassword); $this->_users->Save(); $container->addXmlnukeObject(new XmlnukeText($myWords->Value("CREATEUSEROK"), true)); $container->setUIAlertType(UIAlert::BoxInfo); $this->FormLogin($block); } } }