G
G
Grag2014-03-13 05:17:16
Yii
Grag, 2014-03-13 05:17:16

Why doesn't CaptchaExtended work in Yii?

So:
1. Attached the captcha. Attached the standard. I understood all the hopelessness and frailty of the world, I decided to hide this ugliness and not dishonor my name.
2. The problem has not gone away. Captcha is still needed... I went looking for it.
3. I decided not to go far to the Pacific Ocean, and took it off. site extension .
4. Registered configs:
4.1. In components:

class Controller extends CController
{
  // тыры-пыры, блаблабла и т.д.

    public function init(){
        Yii::$classMap = array_merge( Yii::$classMap, array(
            'CaptchaExtendedAction'       => Yii::getPathOfAlias('ext.captchaExtended').
             '/'.'CaptchaExtendedAction.php',

            'CaptchaExtendedValidator'  => Yii::getPathOfAlias('ext.captchaExtended').
            '/'.'CaptchaExtendedValidator.php'
        ));
    }

}

4.2. On the way Controller:
public function actions()
    {
        return array(
            'captcha'=>array(
                'class'=>'CaptchaExtendedAction',
                'mode' => CaptchaExtendedAction::MODE_WORDS,
            ),
        );
    }

Here's one more thing: I sat on the back of my head for a long time, and in the code of the extension itself (on line 188) I cut out checks for connecting languages ​​to the shaitan. Leaving the good old English.
4.4. The case was close to the model:
array(
     'verifyCode', 'CaptchaExtendedValidator',
     'allowEmpty' => CCaptcha::checkRequirements()
),

All. The settings have been made.
5. Making a widget:
<?php $form->widget('CCaptcha',array('buttonLabel'=>' ')); ?>

When I enter the code - .... Obscene language flies for a long time.
What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Kasymov, 2014-03-13
@HDAPache

If there is ajax validation, then the problem is in it. The captcha code changes during validation, and then when $model->save() occurs, the captcha code is already different, and in the post array the old code, everything is a hat ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question