-
AuthorPosts
-
February 10, 2013 at 4:45 am #184833
I really dislike the ReCaptcha as it is so difficult to read. KeyCAPTCHA is really nice and I’m using it for my VM registration page so I was hoping someone could help me replace ReCaptcha with KeyCAPTCHA in the JALogin module for Vintas.
Thanks a bunch in advance!
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
February 12, 2013 at 6:05 pm #483226I spent entirely my time to integrate KeyCAPTCHA with JA Login Module, you can try to use my solution as follows
Open modules/mod_jalogin/mod_jalogin.php file
from
if(JRequest::getCmd('option') !== "com_users" || JRequest::getCmd('view') !== "registration"){
JForm::addFormPath(JPATH_SITE."/components/com_users/models/forms");
$form = JForm::getInstance('com_users.registration',"registration", array('control' => 'jform'), false, false);
$captcha = $form->getField("captcha");
$captchatext = $captcha->input;
}
change to
if(JRequest::getCmd('option') !== "com_users" || JRequest::getCmd('view') !== "registration"){
$params_keycaptcha = new JParameter(JPluginHelper::getPlugin('system', 'keycaptcha')->params);
$task_message = $params_keycaptcha->get('keycaptcha_custom_task_text');
$view = JRequest::getVar('view');
if ( $task_message == '' ) {
if ( $view == 'register' )
$task_message = JText::_('KEYCAPTCHA_TASK_REGISTRATION_MESSAGE');
else
$task_message = JText::_('KEYCAPTCHA_TASK_COMMON_MESSAGE');
}
$kc_code = $params_keycaptcha->get('keycaptcha_code');
if ( $kc_code[ strlen( $kc_code ) - 1 ] == "'" ) {
$kc_code = substr( $kc_code, 0, strlen( $kc_code ) - 1 );
}
$kc_o = new KeyCAPTCHA_CLASS($params_keycaptcha->get('keycaptcha_site_private_key'), str_replace( '#BUTTONS#', $submit_ids, $kc_code ) );$kc_template = str_replace( '(gt)', '>', str_replace( '(lt)', '<', $params_keycaptcha->get('keycaptcha_html') ) );
if ( strpos( $kc_template, '#keycaptcha#' ) == false ) {
$kc_template = "<br><div id='keycaptcha_div' style='height:220px; padding:0; margin:0; display:table; border:none;'>#keycaptcha#</div>";
}
if ( $kc_template[ strlen( $kc_template ) - 1 ] == "'" ) {
$kc_template = substr( $kc_template, 0, strlen( $kc_template ) - 1 );
}
if ( $task_message[ strlen( $task_message ) - 1 ] == "'" ) {
$task_message = substr( $task_message, 0, strlen( $task_message ) - 1 );
}
$captchaHtmlBlock = str_replace( '#keycaptcha#', '<table style="padding-top:10px; padding-bottom:10px; border:none; " cellpadding="0" cellspacing="0">
<tr style="border:none;"><td style="border:none;"><input type="hidden" id="capcode" name="capcode" value="false" />
'.$task_message.'</td></tr><tr style="border:none;"><td style="border:none;" align="center">'.str_replace( '(gt)', '>', str_replace( '(lt)', '<', $kc_o->render_js() ) ).
'<noscript><b style="color:red;">'.JText::_('KEYCAPTCHA_NOSCRIPT_MESSAGE').'</b></noscript></td></tr></table>', $kc_template );$captchatext = $captchaHtmlBlock;
}
Let me know if it helps
2 users say Thank You to Ninja Lead for this useful post
February 15, 2013 at 7:25 pm #483575<em>@Ninja Lead 359837 wrote:</em><blockquote>I spent entirely my time to integrate KeyCAPTCHA with JA Login Module, you can try to use my solution as follows
Open modules/mod_jalogin/mod_jalogin.php file
from
if(JRequest::getCmd('option') !== "com_users" || JRequest::getCmd('view') !== "registration"){
JForm::addFormPath(JPATH_SITE."/components/com_users/models/forms");
$form = JForm::getInstance('com_users.registration',"registration", array('control' => 'jform'), false, false);
$captcha = $form->getField("captcha");
$captchatext = $captcha->input;
}
change to
if(JRequest::getCmd('option') !== "com_users" || JRequest::getCmd('view') !== "registration"){
$params_keycaptcha = new JParameter(JPluginHelper::getPlugin('system', 'keycaptcha')->params);
$task_message = $params_keycaptcha->get('keycaptcha_custom_task_text');
$view = JRequest::getVar('view');
if ( $task_message == '' ) {
if ( $view == 'register' )
$task_message = JText::_('KEYCAPTCHA_TASK_REGISTRATION_MESSAGE');
else
$task_message = JText::_('KEYCAPTCHA_TASK_COMMON_MESSAGE');
}
$kc_code = $params_keycaptcha->get('keycaptcha_code');
if ( $kc_code[ strlen( $kc_code ) - 1 ] == "'" ) {
$kc_code = substr( $kc_code, 0, strlen( $kc_code ) - 1 );
}
$kc_o = new KeyCAPTCHA_CLASS($params_keycaptcha->get('keycaptcha_site_private_key'), str_replace( '#BUTTONS#', $submit_ids, $kc_code ) );$kc_template = str_replace( '(gt)', '>', str_replace( '(lt)', '<', $params_keycaptcha->get('keycaptcha_html') ) );
if ( strpos( $kc_template, '#keycaptcha#' ) == false ) {
$kc_template = "<br><div id='keycaptcha_div' style='height:220px; padding:0; margin:0; display:table; border:none;'>#keycaptcha#</div>";
}
if ( $kc_template[ strlen( $kc_template ) - 1 ] == "'" ) {
$kc_template = substr( $kc_template, 0, strlen( $kc_template ) - 1 );
}
if ( $task_message[ strlen( $task_message ) - 1 ] == "'" ) {
$task_message = substr( $task_message, 0, strlen( $task_message ) - 1 );
}
$captchaHtmlBlock = str_replace( '#keycaptcha#', '<table style="padding-top:10px; padding-bottom:10px; border:none; " cellpadding="0" cellspacing="0">
<tr style="border:none;"><td style="border:none;"><input type="hidden" id="capcode" name="capcode" value="false" />
'.$task_message.'</td></tr><tr style="border:none;"><td style="border:none;" align="center">'.str_replace( '(gt)', '>', str_replace( '(lt)', '<', $kc_o->render_js() ) ).
'<noscript><b style="color:red;">'.JText::_('KEYCAPTCHA_NOSCRIPT_MESSAGE').'</b></noscript></td></tr></table>', $kc_template );$captchatext = $captchaHtmlBlock;
}
Let me know if it helps</blockquote>Ninja Lead,
Thanks so much for your input. That DID get the KeyCAPTCHA displaying on the JA Login module but it broke the captcha on other pages, such as the virtuemart registration page. If I disable the JA Login module from the VM account maintenance and cart pages, then it works again. I believe that it is a conflict with it trying to be shown twice on the same page, once in the JA Login module and once on the rendered page itself.
Any ideas on this?Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
February 16, 2013 at 8:43 am #483624<blockquote>I believe that it is a conflict with it trying to be shown twice on the same page, once in the JA Login module and once on the rendered page itself.</blockquote>
Sure that, I just tested it and there is conflict of KeyCAPTCHA . I have raised issue to development team here
But you can use JA Login Module without components/modules integration with KeyCAPTCHA or you can also raise this in the KeyCAPTCHA forum, you might get better answers there.
1 user says Thank You to Ninja Lead for this useful post
February 20, 2013 at 7:16 am #483986<em>@Ninja Lead 360394 wrote:</em><blockquote>Sure that, I just tested it and there is conflict of KeyCAPTCHA . I have raised issue to development team here
But you can use JA Login Module without components/modules integration with KeyCAPTCHA or you can also raise this in the KeyCAPTCHA forum, you might get better answers there.</blockquote> Thanks again for the reply and your time, Ninja Lead. Due to the issue with the conflict, I have simply disabled the JA Login on the pages where both captcha’s would display. This has resolved the issue for me and it is an acceptible resolution. It would be nice to not be forced to remove the JA Login from certain pages but I’m not overly concerned with this as a solution.
Thanks again for taking the time to get this working. -
AuthorPosts
This topic contains 5 replies, has 2 voices, and was last updated by whouse 11 years, 9 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum