File: TokenExpire.pm

package info (click to toggle)
libcatalyst-controller-html-formfu-perl 2.04-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 408 kB
  • sloc: perl: 960; makefile: 6
file content (34 lines) | stat: -rw-r--r-- 811 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package TestApp::Controller::TokenExpire;

use strict;
use warnings;
use Data::Dumper;
use base 'Catalyst::Controller::HTML::FormFu';

__PACKAGE__->config(
    {   'Controller::HTML::FormFu' => {
            request_token_session_key     => '_token',
            request_token_enable          => 1,
            request_token_field_name      => 'token',
            request_token_expiration_time => -10
        }
    }
);

sub tokenexpire : Chained : CaptureArgs(0) {
    my ( $self, $c ) = @_;
    $c->stash->{template} = 'form.tt';
}

sub form : Chained('tokenexpire') : Args(0) : Form {
    my ( $self, $c ) = @_;

    my $form = $c->stash->{form};

    $form->elements( [ { name => 'basic_form' }, { type => "Submit" } ] );
    if ( $form->submitted_and_valid ) {
        $c->res->body("VALID");
    }
}

1;