Mojolicious::Plugin::Qaptcha - jQuery QapTcha Plugin for Mojolicious
# Mojolicious $app->plugin('Qaptcha', { inbuild_jquery => 1, inbuild_jquery_ui => 1, inbuild_jquery_ui_touch => 1, txtLock => "LOCKED", txtUnlock => "UNLOCKED", disabledSubmit => "true", autoRevert => "false", autoSubmit => "true", qaptcha_url => '/do_unlock', }); # Mojolicious::Lite plugin 'Qaptcha', { inbuild_jquery => 1, inbuild_jquery_ui => 1, inbuild_jquery_ui_touch => 1, txtLock => "LOCKED", txtUnlock => "UNLOCKED", disabledSubmit => "true", autoRevert => "false", autoSubmit => "true", qaptcha_url => '/do_unlock', };
and in your templates
@@ layouts/default.html.ep <!DOCTYPE html> <html> <head> %= qaptcha_include </head> <body> %= content; </body> </html> @@ index.html.ep %= layout 'default'; <form method="post"> <fieldset> <label>First Name</label> <input name="firstname" type="text"><br> <label>Last Name</label> <input name="lastname" type="text"> <input name="submit" value="Submit form" style="margin-top:15px;" type="submit"> <br /> <!-- put a qaptcha element inside a form --> <div class="QapTcha"></div> </fieldset> </form>
and in your controller
# Mojolicious::Lite any '/' => sub { my $self = shift; do_something if $self->qaptcha_is_unlocked; $self->render('index'); }; # Mojolicious sub index { my $self = shift; do_something if $self->qaptcha_is_unlocked; $self->render('index'); }
Mojolicious::Plugin::Qaptcha is a Mojolicious plugin.
It brings jQuery QapTcha functionality inside your html form in an element with class 'QapTcha'. When QapTcha is unlocked, next request has to submit form. Otherwise QapTcha will be locked back.
Mojolicious::Plugin::Qaptcha inherits all methods from Mojolicious::Plugin and implements the following new ones.
$plugin->register(Mojolicious->new, $options_hash);
Register plugin in Mojolicious application.
Includes (optional configured) jquery and qaptcha javascript.
Returns 1 if QapTcha is unlocked.
If set to 1 jQuery 1.8.2 is rendered into %= qaptcha_include.
If set to 1 jQuery UI - v1.8.2 is rendered into %= qaptcha_include.
If set to 1 jQuery.UI.iPad plugin is rendered into %= qaptcha_include.
Text to display for locked QapTcha
Text to display for unlocked QapTcha
Add the "disabled" attribut to the submit button default: false
Slider returns to the init-position, when the user hasn't dragged it to end default: true
If true, auto-submit form when the user has dragged it to the end default: false
Configurable route to unlock qaptcha
an example is located in ex/qaptcha.pl.
To install this module, run the following commands:
perl Build.PL ./Build ./Build test ./Build install
SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::Qaptcha
You can also look for information at:
AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Mojolicious-Plugin-Qaptcha CPAN Ratings http://cpanratings.perl.org/d/Mojolicious-Plugin-Qaptcha Search CPAN http://search.cpan.org/dist/Mojolicious-Plugin-Qaptcha/
http://github.com/hrupprecht/Mojolicious-Plugin-Qaptcha
Holger Rupprecht - Holger.Rupprecht@gmx.de
Holger.Rupprecht@gmx.de
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
Copyright (C) 2013 by Holger Rupprecht
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mojolicious::Plugin::Qaptcha, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Qaptcha
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Qaptcha
For more information on module installation, please visit the detailed CPAN module installation guide.