Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capcha always show incorrect

Tags:

captcha

yii2

I have used capcha in one of my forms. It always give verification code incorrect error.

Below is my code:

SchoolsController.php

public function actions() {
        return [
            'captcha' => [
                'class' => 'yii\captcha\CaptchaAction',
                'fontFile' => '@yii/captcha/SpicyRice.ttf',
                'padding' => '0',
            ]
        ];
    }

Model:

['verifyCode', 'captcha', 'captchaAction' => 'schools/captcha'],

View:

echo $form->field($modelSchoolRequestEarlyAccess, 'verifyCode')->widget(Captcha::className(), [
                        'options' => [
                            'placeholder' => 'Enter characters in the image',
                            'autocomplete' => 'off',
                            'maxlength' => 20 
                        ],
                        'captchaAction' => 'schools/captcha',
                        'template' => "<div class='field'><span><strong>*</strong>".Yii::t('frontend/quicksignup','VerifyCodeLabel').":</span></span>\n<div>{image}{input}<i class='refresh-code-icn' id='get-new-code'></i></div></div>"
                        ])->label(false); 

I have specified the captcha action as schools/captcha in model as well as view. But it always show verification incorrect.

What am I doing wrong??

like image 315
Prashant Patil Avatar asked Apr 06 '16 09:04

Prashant Patil


People also ask

Why does it keep saying incorrect CAPTCHA?

If your CAPTCHA isn't being accepted, the problem might not be with your reading or your typing — the code might simply have expired. If you open a page and don't submit your entry form right away, your CAPTCHA might be invalid.

How do I fix CAPTCHA incorrect value?

Therefore, ''Incorrect CAPTCHA'' message is displayed. The solution is pretty easy: just disable the default Magento 2 captcha or third-party captcha in the admin. The ''Incorrect CAPTCHA'' message should be gone. If it still appears, please do not hesitate to create a support ticket.

Why does CAPTCHA not work sometimes?

How do I fix a reCAPTCHA issue? One of the most common reasons why this error occurs is that of an outdated Chrome version. reCAPTCHA will actively look at the browser version before allowing you access. This is applicable to all browser versions, not just Chrome.


1 Answers

You wrote SchoolController.php and your route is to schools. So you probably need to adjust your route to school/captcha

like image 150
Edofre Avatar answered Oct 20 '22 23:10

Edofre