paulg

Captcha not working on Agent Form

5 posts in this topic

Hi

I see there was a previous post on this but I am unable to see a resolve.

I have added recaptcha to my site and added the appropriate keys and script. The recaptcha field appears on the Agent Form - but if I enter content and hit submit (without checking the recaptcha box) the form submits anyway.

You can see the set up example here http://www.dalron.com/applewood-available-listings/lot-22w-27-applewood-court-2

Is there a fix for this? I have version 2.10 (latest of the component installed)

Thank you.

 

Share this post


Link to post
Share on other sites

You have to add some code to the following file components/com_bt_property/controllers/agent.php

 

on about line 27 find "function sendmsg(); { "

and copy the following:

	function sendmsg() {

		JRequest::checkToken() or jexit('Invalid Token');
                $captcha = JFactory::getConfig ()->get ( 'captcha' );
                $return_url = base64_decode(JRequest::getVar('return',''));

        if($captcha) {
            $reCaptcha = JCaptcha::getInstance($captcha);
            $checkCaptcha = $reCaptcha->checkAnswer('');

            if(!$checkCaptcha){
                $msg= JTEXT::_('Incorrect CAPTCHA entered. Please try again.');
                if($return_url){
                    $this->setRedirect($return_url, $msg);
                }else{
                    $this->setRedirect(JRoute::_('index.php'), $msg);
                }
               return;
            }
        }

		$app = JFactory::getApplication();
		$agent = JUser::getTable();
		$agent->load($app->input->getInt('agent_id'));
		$name = $app->input->getString('name');
		$email = $app->input->getString('email');

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now