NAME

Sledge::Plugin::Captcha - create and validate Captcha for Sledge.

SYNOPSIS

    package Your::Pages;
    use base qw/Sledge::Pages::Compat/;
    use Sledge::Plugin::ShowImage;
    use Sledge::Plugin::Captcha;

    sub dispatch_show_captcha {
        my ($self, ) = @_;

        $self->create_captcha;
    }

    sub valid_post {
        my ($self, ) = @_;

        unless ($self->validate_captcha($self->r->param('captcha'))) {
            $self->valid->set_error(CAPTCHA_ERROR => 'captcha');
        }
    }

    # config.yaml
    common:
      captcha:
        new:
          width:   180
          height:  30
          lines:   5
          gd_font: giant
        create:
          - normal
          - ec
        particle:
          - 100
        session_name: captcha_string
        out:
          force: jpeg

DESCRIPTION

This plugin create, validate Captcha.

Note: This plugin uses GD::SecurityImage

METHODS

show_captcha

Create Captcha image and output it.

validate_captcha

  $c->validate_captcha($key);

validate key

captcha_string

Return a string for validation which is stored in session.

clear_captcha_string

Clear a string which is stored in session.

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.

AUTHOR

Tokuhiro Matsuno <tokuhiro __at__ mobilefactory.jp>

THANKS TO

Masahiro Nagano

SEE ALSO

Catalyst::Plugin::Captcha

LICENCE AND COPYRIGHT

Copyright (c) 2007, Tokuhiro Matsuno <tokuhiro __at__ mobilefactory.jp>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.