Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length


VirtueMart 1.1.4 - [MAINTENANCE RELEASE] is available! Read more....

  Advanced search

188999 Posts in 50522 Topics- by 52207 Members - Latest Member: jonathan03m
Pages: [1] 2 3 4   Go Down
Print
Author Topic: Captcha - just another  (Read 31875 times)
Replika
Newbie
*
Posts: 39



View Profile
« on: May 10, 2008, 10:28:37 am »

Yes, Virtuemart can intergrate with SecurityImages, but that extension is really bloated to me. So, I tried my own way.

If you have time, please check my mod (for VM1.1 and J1.5):

1. Install my extensions: com_tincaptcha and plg_tincaptcha.
( Joomla Extension )
Remember to active the plugin. You can change some settings with it.

2. FILE: administrator\components\com_virtuemart\html\admin.user_field_form.php
LINE 81:
Code:
if( file_exists($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php')) {
REPLACE WITH:
Code:
if (JPluginHelper::isEnabled('system', 'tincaptcha')) { // tincaptcha

3. FILE: administrator\components\com_virtuemart\classes\ps_userfield.php
LINE 429:
Code:
if (file_exists($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php')) {
include ($mosConfig_absolute_path.'/administrator/components/com_securityimages/client.php');
// Note that this package name must be used on the validation site too! If both are not equal, validation will fail
$packageName = 'securityVMRegistrationCheck';
echo insertSecurityImage($packageName);
echo getSecurityImageText($packageName);
}
REPLACE WITH:
Code:
if (JPluginHelper::isEnabled('system', 'tincaptcha'))
{
echo '<input type="text" id="'.$field->name.'" name="'.$field->name.'" size="'.$field->size.'" value="" class="inputbox" /><br /><img src="index.php?option=com_tincaptcha&task=captcha_display" />'."\n";
}

4. FILE: administrator\components\com_virtuemart\classes\ps_shopper.php
LINE 76:
Code:
if( file_exists($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php')) {
include_once( $mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php');
$packageName = 'securityVMRegistrationCheck';
$security_refid = vmGet($_POST, $packageName.'_refid');
$security_try = vmGet($_POST, $packageName.'_try');
$security_reload = vmGet($_POST, $packageName.'_reload');
$checkSecurity = checkSecurityImage($security_refid, $security_try );

if( !$checkSecurity ) {
$provided_required = false;
$missing .= $field->name . ",";
}
}
REPLACE WITH:
Code:
if (JPluginHelper::isEnabled('system', 'tincaptcha'))
{
$checkSecurity = plgSystemTincaptcha::check($d[$field->name]);
if ($checkSecurity !== true)
{
$provided_required = false;
$missing .= $field->name . ",";
JError::raiseWarning(0, $checkSecurity);
}
}

LINE 176:
Code:
if( file_exists($mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php')) {
include_once( $mosConfig_absolute_path.'/administrator/components/com_securityimages/server.php');
$packageName = 'securityVMRegistrationCheck';
$security_refid = vmGet($_POST, $packageName.'_refid');
$security_try = vmGet($_POST, $packageName.'_try');
$security_reload = vmGet($_POST, $packageName.'_reload');
$checkSecurity = checkSecurityImage($security_refid, $security_try );

if( !$checkSecurity ) {
$provided_required = false;
$missing .= $field->name . ",";
}
}
REPLACE WITH:
Code:
if (JPluginHelper::isEnabled('system', 'tincaptcha'))
{
$checkSecurity = plgSystemTincaptcha::check($d[$field->name]);
if ($checkSecurity !== true)
{
$provided_required = false;
$missing .= $field->name . ",";
JError::raiseWarning(0, $checkSecurity);
}
}

5. Create new field.
In Manage User Fields, create a new one like this:


Screenshot:



For Product Enquiry hack, see the Post#21
« Last Edit: June 27, 2008, 13:44:56 pm by Replika » Logged
aravot
Peter
Moderator
Hero Member
*
Posts: 2724


View Profile WWW
« Reply #1 on: May 15, 2008, 02:15:51 am »

Tested it's working.

Feedback, when in Field Manger trying to add Captcha field the title reads 'Captcha field (using com_securityimages)' you might want to change that.

com_tincaptcha is not shown in component menu is this the intended effect.
Logged

Replika
Newbie
*
Posts: 39



View Profile
« Reply #2 on: May 15, 2008, 12:44:00 pm »

com_tincaptcha is not shown in component menu is this the intended effect.
Thanks for testing.
The component is just for display captcha image
<img src="index.php?option=com_tincaptcha&task=captcha_display" />
We can no need that component, but I create it for easier intergating and for languages installing.
Captcha settings could be found in Plugin page.
Logged
korb
Quality&Testing Team
Hero Member
*
Posts: 689



View Profile WWW
« Reply #3 on: May 15, 2008, 13:32:17 pm »

where do we copy the lang files?
Logged

korb
Quality&Testing Team
Hero Member
*
Posts: 689



View Profile WWW
« Reply #4 on: May 15, 2008, 14:09:36 pm »

oh, I found it, the lang files go to joomla\language as a part of Joomla frontend files.

BUT how can I set the background a different colour, like a pure white?
I tried inserting FFFFFF code for white, and the background turns black....
Please advise
« Last Edit: May 15, 2008, 14:11:22 pm by korb » Logged

Replika
Newbie
*
Posts: 39



View Profile
« Reply #5 on: May 15, 2008, 16:23:45 pm »

BUT how can I set the background a different colour, like a pure white?
Value in background field should be 255,255,255. Hover the title, you can see the tip
« Last Edit: May 15, 2008, 16:27:17 pm by Replika » Logged
korb
Quality&Testing Team
Hero Member
*
Posts: 689



View Profile WWW
« Reply #6 on: May 15, 2008, 20:49:52 pm »

Thanks,
BUT
When we shall have a stable and easy instalable version of your great component?

aaand

How about a refresh button for another generated code?
« Last Edit: May 15, 2008, 20:53:50 pm by korb » Logged

Replika
Newbie
*
Posts: 39



View Profile
« Reply #7 on: May 16, 2008, 16:34:46 pm »

How about a refresh button for another generated code?

http://forum.joomla.org/viewtopic.php?f=46&t=291204
Logged
korb
Quality&Testing Team
Hero Member
*
Posts: 689



View Profile WWW
« Reply #8 on: May 16, 2008, 19:00:59 pm »

ok, I've seen your post in the Joomla Forum, but shouldn't be more strings in the language file? Smiley
Logged

aravot
Peter
Moderator
Hero Member
*
Posts: 2724


View Profile WWW
« Reply #9 on: May 16, 2008, 20:08:27 pm »

I just noticed, Captcha is shown on invoice.
Logged

korb
Quality&Testing Team
Hero Member
*
Posts: 689



View Profile WWW
« Reply #10 on: May 17, 2008, 00:23:25 am »

I just noticed, Captcha is shown on invoice.
Is it good or bad?
Logged

aravot
Peter
Moderator
Hero Member
*
Posts: 2724


View Profile WWW
« Reply #11 on: May 17, 2008, 00:26:55 am »

It does no harm but it could be weird for customer to see 'Captcha: 7wX4' on invoice
Logged

Replika
Newbie
*
Posts: 39



View Profile
« Reply #12 on: May 17, 2008, 05:43:23 am »

Quote
ok, I've seen your post in the Joomla Forum, but shouldn't be more strings in the language file?
because I only want keep this plugin minimal as possible

I just noticed, Captcha is shown on invoice.
Could you please explain more this issue. I just replace the securityimages part in source. It seems Virtuemart auto print all required fields to invoice?

--Edit--
Did you disable Show in shipping form in Captcha Field? Do not know the core check it or not
« Last Edit: May 17, 2008, 06:26:31 am by Replika » Logged
mylearningspace
Newbie
*
Posts: 17


View Profile
« Reply #13 on: May 18, 2008, 15:21:12 pm »


can you pls be more specific how, where to edit 'img src' tag for virtuemart to achieve refresh button. im supposing you're referring to ps_userfield.php but i can't get syntax correct.
Logged
Replika
Newbie
*
Posts: 39



View Profile
« Reply #14 on: May 18, 2008, 17:39:27 pm »

can you pls be more specific how, where to edit 'img src' tag for virtuemart to achieve refresh button. im supposing you're referring to ps_userfield.php but i can't get syntax correct.
Since the html tag is in php function echo, you should addslash single quote character (')

In Step3:
Code:
if (JPluginHelper::isEnabled('system', 'tincaptcha'))
{
echo '<input type="text" id="'.$field->name.'" name="'.$field->name.'" size="'.$field->size.'" value="" class="inputbox" /><br />
<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src=\'index.php?option=com_tincaptcha&task=captcha_display&t=\'+(new Date()).getTime()" alt="Click to refresh image" />'."\n";
}
Logged
Pages: [1] 2 3 4   Go Up
Print
Jump to: