Differences
This shows you the differences between two versions of the page.
Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
systems:yii2:email_tools [2018/05/10 17:17] smayr [Setup Captcha] |
systems:yii2:email_tools [2018/05/14 11:08] (current) smayr [Setup Captcha] |
| |
== Setup Captcha == | == Setup Captcha == |
| |
| ''CaptchaAction'' requires either GD2 extension or ImageMagick PHP extension. Check that it meets this requirement. |
| |
In controller's function ''behaviors()'', add ''captcha'' to ''actions'' for user group that requires the use ot if: | In controller's function ''behaviors()'', add ''captcha'' to ''actions'' for user group that requires the use ot if: |
<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [ | <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [ |
'captchaAction' => 'site/captcha', // redirect to correct controller where captcha is defined | 'captchaAction' => 'site/captcha', // redirect to correct controller where captcha is defined |
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>', | 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>', |
]) ?> | ]) ?> |
</code> | </code> |
| |
| See more: |
| * [[https://www.yiiframework.com/doc/api/2.0/yii-captcha-captchaaction|Yii CaptchaAction]] |