Jaxel
Well-known member
So I wrote a StopForumSpam function on my XenUtiles release...
Looks simple right? It checks against errors, and if the number of errors exceed the error requirement for the StopForumSpam check, it returns the errors back to the parent. This works. If the error requirement is met, it is properly displays the errors such as "Your username was found on the StopForumSpam database and has been rejected."
However, the problem is that even though the error is presented to the user, it still registers their account. I just tested it on my forums by registering with known spammer usernames and emails; it did properly give me StopForumSpam errors, but as long as I filled in all the rest of the required information, it still registered my account and presented "Your account is currently awaiting confirmation." on top of the registration form.
How do I fix this?
Code:
<?php
class EWRutiles_ControllerPublic_Register extends XFCP_EWRutiles_ControllerPublic_Register
{
public function actionRegister()
{
$response = parent::actionRegister();
$options = XenForo_Application::get('options');
$data = $this->_input->filter(array(
'username' => XenForo_Input::STRING,
'email' => XenForo_Input::STRING,
));
$data['ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : false;
$errors = $this->getModelFromCache('EWRutiles_Model_ForumSpam')->checkDatabase($data, $count);
if ($count >= $options->EWRutiles_forumspam_hound)
{
return $this->_getRegisterFormResponse($data, $errors);
}
return $response;
}
}
However, the problem is that even though the error is presented to the user, it still registers their account. I just tested it on my forums by registering with known spammer usernames and emails; it did properly give me StopForumSpam errors, but as long as I filled in all the rest of the required information, it still registered my account and presented "Your account is currently awaiting confirmation." on top of the registration form.
How do I fix this?