315

Product support

Get help in the plugin support forum.

  • Added on May 6, 2020
  • Current version: 1.0.2
  • Created by

Categories

Simple captcha for your website

Video manual

Based on https://github.com/mewebstudio/captcha

Need jquery and {% scripts %} in layout.

Captcha Types

  • default
  • math
  • flat
  • mini
  • inverse

To use your own settings, publish config.

$ php artisan vendor:publish --provider="Mews\Captcha\CaptchaServiceProvider"

config/captcha.php

return [
    'default'   => [
        'length'    => 5,
        'width'     => 120,
        'height'    => 36,
        'quality'   => 90,
        'math'      => true, //Enable Math Captcha
    ],
    // ...
];

Using example

home.html

title = "Demonstration"
url = "/"
layout = "default"
is_hidden = 0

[sitecaptcha]
type = "default"
showrefresh = "show"
iconclass = "icon-refresh"
==
<?php
function onTest()
{

    $rules = ['captcha' => 'required|captcha_api:'. Session::get('captcha.key')];

    $messages = [
            'captcha.captcha_api' => 'wrong captcha',
        ];

    $validator = validator()->make(request()->all(), $rules, $messages);

    if ($validator->fails()) {

        throw new ValidationException($validator);

    } else {

        Flash::success('Success');

    }

}
?>
==
<div class="container">

<form data-request="onTest"  data-request-flash data-request-complete="updateCaptcha()">

  <div class="form-group">
    <label for="email">Email address:</label>
    <input type="email" class="form-control" id="email">
  </div>

  <div class="form-group">
    <label for="pwd">Password:</label>
    <input type="password" class="form-control" id="pwd">
  </div>

  <div class="form-group">
    {% component 'sitecaptcha' %}
  </div>

  <div class="form-group">
    <label for="pwd">Captcha:</label>
    <input class="form-control" type="text" name="captcha"/>
  </div>

  <div class="checkbox">
    <label><input type="checkbox"> Remember me</label>
  </div>
  <button type="submit" class="btn btn-default">Submit</button>
</form>

</div>

You can also use Captcha::check('captcha text') to check captcha.

function onTest()
{   
    if (Captcha::check(input('captcha'))){      
        Flash::success('Success');
    }
}

Video manual

  • Found the plugin useful on 22 Jun, 2021

    Thank you, Vladimir, that ist useful.

  • Found the plugin useful on 7 May, 2020

    Nice plugin, very good alternative to google recaptcha, tks! the only thing I would like to add is "event.stopPropagation()" or "return false;" inside updateCaptcha() method because if the page is long when you click on refresh icon it takes you to the page top (I think that way it can be solved)

  • author

    Replied on 7 May, 2020

    Thanks for your feedback. I fixed the captcha refresh. Please update the plugin.

1.0.2

fix

May 07, 2020

1.0.1

Initialize plugin.

May 06, 2020