E
E
EVOSandru62015-12-09 13:03:58
Yii
EVOSandru6, 2015-12-09 13:03:58

Why can captcha be called in Yii1 in a scenario where it is not mentioned?

Good afternoon,
I have a mathematical captcha for user registration, as in the ryut recipes of Alexander Makarov, the same in this link
www.dbhelp.ru/mathematics-captcha/page
In the rules of the model:

['verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(), 'on'=>['registration']],

In protected/controllers/UsersController
public function actions()
    {
        return
        [
            // captcha action renders the CAPTCHA image displayed on the contact page

            'captcha' =>
            [
                'class'          =>      'application.modules.crud.components.actions.default.MathCaptchaAction',
                'minLength'      =>      2,
                'maxLength'      =>      10,
                'testLimit'      =>      1, 
                //'backColor'    =>     0xFFFFFF,
            ]
        ];
    }

There is an admin module,
protected/sadmin/controllers/UsersController In it
, I don’t talk about captcha at all
And in the Action Users Grid , admin built a switch column like this: In general, this is not very important, the point is that I change the value of one field in the model) On all other grids (in models of which captcha is not used at all and does not cling to the external action in the controller), the switch works. BUT it is in the user grid that when trying to change the status ( field confirm ) the following error is thrown:



2015/12/09 12:23:27 [error] [php] mt_rand(): max(0) is smaller than min(1) (C:\OpenServer\domains\hotel\protected\modules\crud\components\actions \default\MathCaptchaAction.php:26)

Allegedly, I access this captcha with an external action, but in the controller in the Admin panel, the external action does not cling at all.
In the Client controller UsersController registration fulfills as it is necessary.
What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2015-12-09
@Sassoft

Is the captcha registered in the admin Users controller action?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question