(1) 2 »
Roby73 Roby73
  • Friend of XOOPS
  • Friend of XOOPS
  • Joined: 2011/6/15 17:31
  • From Torino
  • Group: Registered Users
  • Posts: 262
  • Posted on: 2011/11/23 8:57
class/captcha #1
HI.
I have this problem.
In config.php i have set the 'skipmember' => false, // Skip CAPTCHA check for members, but the capatcha code is not visible at users.... only anonymous

I use recapatcha code, the problem seems to be in the file xoopscaptcha.php.

Thank you very much!.
timgno timgno
  • Module Developer
  • Module Developer
  • Joined: 2007/6/21 14:54
  • From Italy
  • Group: Registered Users
  • Posts: 1497
  • Posted on: 2011/11/23 10:38
Re: class/captcha #2
For register only anonymous should see it, if you use it in other modules you need to add the code in these
trabis trabis
  • Core Developer
  • Core Developer
  • Joined: 2006/9/1 14:10
  • From Portugal
  • Group: Webmaster Registered Users
  • Posts: 2253
  • Posted on: 2011/11/23 13:54
Re: class/captcha #3
What is the module displaying the captcha?
Roby73 Roby73
  • Friend of XOOPS
  • Friend of XOOPS
  • Joined: 2011/6/15 17:31
  • From Torino
  • Group: Registered Users
  • Posts: 262
  • Posted on: 2011/11/23 17:31
Re: class/captcha #4
I modified some modules with capatcha code (with system class).
tellafirend and xfguestbook

In these modules the capatcha code is visible only a anonymous users.

kipmember' => false/true don't change.

trabis trabis
  • Core Developer
  • Core Developer
  • Joined: 2006/9/1 14:10
  • From Portugal
  • Group: Webmaster Registered Users
  • Posts: 2253
  • Posted on: 2011/11/23 20:15
Re: class/captcha #5
Can you show me the code you used?
Did you try to add skipmember in recatpcha.config.php, both configs are loaded and merged.

Did you test the change during the same session? You may want to logout and login again after you apply the change.
Roby73 Roby73
  • Friend of XOOPS
  • Friend of XOOPS
  • Joined: 2011/6/15 17:31
  • From Torino
  • Group: Registered Users
  • Posts: 262
  • Posted on: 2011/11/23 22:17
Re: class/captcha #6
In the module xfguestbook and in the file xfcreate.php i add in all switch(op) the code:

xoops_load('XoopsCaptcha');
        
$xoopsCaptcha XoopsCaptcha::getInstance();
        if (!
$xoopsCaptcha->verify()) {
            
$msgstop .= $xoopsCaptcha->getMessage();
        }


And in the file form_sign.inc.php the code:

$button_tray->addElement(new XoopsFormCaptcha(), true);


With anonymous user all is ok, but not with register user.
I try add skipmember in config.recatpcha.php, don't work.
I test in new sessions, logout/login and cleaning all cache.

try changing the code in xoopscaptcha.php, recaptcha work in all condition.... registered user, anonymous and all groups.
the problem seems to be at line 112

if (!empty($this->config['skipmember']) && is_object($GLOBALS['xoopsUser'])) {
            
$this->active false;
            return 
$this->active;
        }


and line 209

} else if (is_object($GLOBALS['xoopsUser']) && ! empty($skipMember)) {
            
$is_valid true;


Thank you trabis
trabis trabis
  • Core Developer
  • Core Developer
  • Joined: 2006/9/1 14:10
  • From Portugal
  • Group: Webmaster Registered Users
  • Posts: 2253
  • Posted on: 2011/11/24 13:57
Re: class/captcha #7
I see the problem, you are using:
$button_tray->addElement(new XoopsFormCaptcha(), true);


Notice the that XoopsFormCaptcha constructor accepts the following params:
$caption ''$name 'xoopscaptcha'$skipmember true$configs = array()


As you see, by default, a XoopsFormCaptcha will skip members. I'm not sure if this behavior is ideal because it overrides the config file settings.

Anyway, you will need to change your line into:
$button_tray->addElement(new XoopsFormCaptcha('''xoopscaptcha'false), true);


Roby73 Roby73
  • Friend of XOOPS
  • Friend of XOOPS
  • Joined: 2011/6/15 17:31
  • From Torino
  • Group: Registered Users
  • Posts: 262
  • Posted on: 2011/11/24 19:29
Re: class/captcha #8
Thank trabis for your help.
The code work with registered user
But i don't understand, the general config 'skipmember' can be setted? Or is only possible set it in single module?

I would set skipmember for all modules in one time.

Thank you
trabis trabis
  • Core Developer
  • Core Developer
  • Joined: 2006/9/1 14:10
  • From Portugal
  • Group: Webmaster Registered Users
  • Posts: 2253
  • Posted on: 2011/11/24 19:45
Re: class/captcha #9
Quote:

Roby73 wrote:
But i don't understand, the general config 'skipmember' can be setted? Or is only possible set it in single module?)


That is why I said:
Quote:
I'm not sure if this behavior is ideal because it overrides the config file settings.


It does not make sense to have a config that does not apply as default.

I think this can be qualified as a bug in the XoopsCaptchaForm class.

skipmember should be set to null, and if null, it should check for the setting used on config file, if it was no setting on config file, then it would set it to true.

I'll see if I can do this on 2.5.5
Roby73 Roby73
  • Friend of XOOPS
  • Friend of XOOPS
  • Joined: 2011/6/15 17:31
  • From Torino
  • Group: Registered Users
  • Posts: 262
  • Posted on: 2011/11/24 20:06
Re: class/captcha #10
Sorry i had not read
Quote:
I'm not sure if this behavior is ideal because it overrides the config file settings.

Thanks for Everything and for your good job
How to effectively post a question in the Xoops forums? - Read here...
Design by: XOOPS UI/UX Team