NAME
Mojolicious::Plugin::Captcha - create and validate captcha for Mojolicious framework
VERSION
0.01
SYNOPSIS
# Mojolicious
$self->plugin(
'captcha',
{
session_name => 'captcha_string',
out => {force => 'jpeg'},
particle => [0,0],
create => [qw/normal rect/],
new {
rnd_data => [0...9, 'A'...'Z'],
width => 80,
height => 30,
lines => 7,
gd_font => 'giant',
}
}
);
package MyApp::MyController;
sub captcha {
my $self = shift;
$self->render( data => $self->create_captcha );
}
sub some_post : Local {
my ($self, $c) = @_;
if ($self->validate_captcha($c->req->param('captcha')){
..
} else {
..
}
}
DESCRIPTION
This plugin create and validate Captcha, using GD::SecurityImage
METHODS
create_captcha
Create Captcha image and output it.
validate_captcha
Validate captcha string
CONFIGURATION
- session_name
-
The keyword for storing captcha string
- new
- create
- particle
- out
-
These parameters are passed to each GD::Security's method. Please see GD::SecurityImage for details.
SUPPORT
SEE ALSO
GD::SecurityImage, Mojolicious, Mojolicious::Plugin
COPYRIGHT & LICENSE
Copyright 2013 zar. All right reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.