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??
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.
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.
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.
You wrote SchoolController.php and your route is to schools. So you probably need to adjust your route to school/captcha
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With