Skip to content
Browse files

captcha addons example

  • Loading branch information...
1 parent e88fbdb commit 5dbf271b4fc8f5c4427fbb86b1b40d970a14a840 vadym committed
Showing with 40 additions and 0 deletions.
  1. +1 −0 addons/x_captcha
  2. +1 −0 addons/x_recaptcha
  3. +37 −0 docs/interactive-views_form-captcha.md
  4. +1 −0 lib/Model/Menu.php
1 addons/x_captcha
@@ -0,0 +1 @@
+Subproject commit 5fffdd1421c0de3c5b97b72cf567269dbf5f0e5b
1 addons/x_recaptcha
@@ -0,0 +1 @@
+Subproject commit b7b3a3a357220d27b65cc5ed29bb8b875d1e9896
View
37 docs/interactive-views_form-captcha.md
@@ -0,0 +1,37 @@
+# Captcha
+
+There two captcha plugins for ATK4.
+
+## x_captcha
+[x_captcha](https://github.com/rvadym/x_captcha)
+
+Don't forget to clone addon to your project first.
+
+ $f = $page->add('Form');
+ $f->addField('Line','captcha')->add('x_captcha/Controller_Captcha');
+ $f->addSubmit('Verify captcha');
+ $f->onSubmit(function($f) {
+ if ( $f->get('captcha') == mb_strtolower($f->getElement('captcha')->captcha->recallCaptcha()) ) {
+ $f->js()->univ()->alert('Good captcha')->execute();
+ } else {
+ $f->js()->univ()->alert('Bad captcha')->execute();
+ }
+ });
+
+
+## reCAPTCHA (from Google)
+[x_recaptcha](https://github.com/rvadym/x_recaptcha)
+
+Don't forget to clone addon to your project first. <br>
+Use <strong>Recaptcha.reload()</strong> to reload captcha with no page reload.
+
+ $f = $page->add('Form');
+ $f->add('x_recaptcha/Controller_ReCaptcha','captcha');
+ $f->addSubmit('Verify captcha');
+ $f->onSubmit(function($f) {
+ if ($f->recaptcha->isCaptchaOk) {
+ $f->js(null,'Recaptcha.reload()')->univ()->alert('Good captcha')->execute();
+ } else {
+ $f->js(null,'Recaptcha.reload()')->univ()->alert('Bad captcha')->execute();
+ }
+ });
View
1 lib/Model/Menu.php
@@ -64,6 +64,7 @@ function init(){
'form' => 'Form',
'form-plain' => 'Form/Plain',
'form-fields' => 'Form fields',
+ 'form-captcha' => 'Form captcha',
'trees' => 'Trees',
'custom-ajax' => 'Custom AJAX',
),

0 comments on commit 5dbf271

Please sign in to comment.
Something went wrong with that request. Please try again.