Prevent SPAM with captcha

More
9 years 9 months ago #4491 by vietvh
Replied by vietvh on topic Prevent SPAM with captcha
Hi Gokk,

I moved this topic into Feature Request forum and still waiting to hear feedback from other users to see if they have the same interest in this feature. If this feature is needed by other users as well we will consider it for our next release.

How far are you going with captcha implementation in your site? Do you need any technical assist from us?

Regards,

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #4492 by Gokk
Replied by Gokk on topic Prevent SPAM with captcha
Hi,
I haven't even started, can you help me with this? what to add where...

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #4493 by Gokk
Replied by Gokk on topic Prevent SPAM with captcha
Okay,
I've been playing around with it, but no luck so far, using joomla recaptcha plugin, here is what I did:
- Created public and private key on: www.google.com/recaptcha (used localhost and yeah, key works under 127.0.0.1)
- Enabled and entered keys in Joomla Captcha - ReCaptcha plugin.
Found this:

Goes to file where you want to show recaptcha:
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onInit','dynamic_recaptcha_1');

//html code inside form tag
<div id="dynamic_recaptcha_1"></div>

This goes to file that is validating/processing the form:
$post = JRequest::get('post');      
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$res = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);
if(!$res[0]){
    die('Invalid Captcha');
}
NOTE! found this for Joomla 3x
$post = JFactory::getApplication()->input->post;
$dispatcher = JEventDispatcher::getInstance();

Now I need you to tell me please where exactly (what file and what line) do I put the codes in???

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #4494 by vietvh
Replied by vietvh on topic Prevent SPAM with captcha
Hi,

Since you want to put the Captcha form into step 2 (Guest info), you need to put your Captcha checking into this file:

/components/com_solidres/controllers/reservation.json.php
public function processGuestInfo($data)
{
// Put your check here
}

This is where the guest info is processed.

Regards,
The following user(s) said Thank You: Gokk

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago - 9 years 9 months ago #4496 by Gokk
Replied by Gokk on topic Prevent SPAM with captcha
Okay, I did that, what next?

Meaning, I inserted the code:
/components/com_solidres/controllers/reservation.json.php
$post = JRequest::get('post');      
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance();
$res = $dispatcher->trigger('onCheckAnswer',$post['recaptcha_response_field']);
if(!$res[0]){
    die('Invalid Captcha');
}

I guess this goes to: /components/com_solidres/controllers/reservation.php
...all fields are here, I've added <div> under the fieldset...
<fieldset>
<p class="help-block">'. JText::_("SR_RESERVATION_NOTE").'</p>					
</fieldset>
<div id="dynamic_recaptcha_1"></div>
</div>

What about code for showing the captcha, what do I use and where?
Last edit: 9 years 9 months ago by Gokk.

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #4506 by vietvh
Replied by vietvh on topic Prevent SPAM with captcha
Hi,

If you want to use Joomla Recaptcha plugin, please make sure that you understand how it is implemented in Joomla Core components like com_users.

docs.joomla.org/How_do_you_use_Recaptcha_in_Joomla%3F

Regards,

Please Log in or Create an account to join the conversation.

Moderators: solidres
Powered by Kunena Forum

All the things you need to make your work easier. Did you like Solidres?