1
Roby73
class/captcha
  • 2011/11/23 13:57

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


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!.

2
timgno
Re: class/captcha
  • 2011/11/23 15:38

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


For register only anonymous should see it, if you use it in other modules you need to add the code in these

3
trabis
Re: class/captcha
  • 2011/11/23 18:54

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


What is the module displaying the captcha?

4
Roby73
Re: class/captcha
  • 2011/11/23 22:31

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


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.


5
trabis
Re: class/captcha
  • 2011/11/24 1:15

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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.

6
Roby73
Re: class/captcha
  • 2011/11/24 3:17

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


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

7
trabis
Re: class/captcha
  • 2011/11/24 18:57

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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);



8
Roby73
Re: class/captcha
  • 2011/11/25 0:29

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


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

9
trabis
Re: class/captcha
  • 2011/11/25 0:45

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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

10
Roby73
Re: class/captcha
  • 2011/11/25 1:06

  • Roby73

  • Friend of XOOPS

  • Posts: 262

  • Since: 2011/6/15


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

Login

Who's Online

268 user(s) are online (162 user(s) are browsing Support Forums)


Members: 0


Guests: 268


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits