From ce69977fefb29ec45af867cdbfa854eabdd2d3b4 Mon Sep 17 00:00:00 2001 From: Aaron Trevena Date: Tue, 5 Jul 2005 08:04:48 +0000 Subject: [PATCH] repeat submission identification git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@343 48953598-375a-da11-a14b-00016c27c3ee --- Changes | 3 +++ Makefile.PL | 1 + lib/Maypole.pm | 10 ++++++++++ templates/factory/addnew | 1 + templates/factory/edit | 9 +++++---- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 1ce12ab..4c0ff4a 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,9 @@ For information about current developments and future releases, see: Small fix to templates/factory/frontpage ( http://rt.cpan.org/NoAuth/Bug.html?id=11236 ) MasonX support in Maypole::Application ( https://rt.cpan.org/NoAuth/Bug.html?id=12383 ) Maypole::Model::CDBI::Plain / Maypole Config issue ( http://rt.cpan.org/NoAuth/Bug.html?id=11530 ) + Repeat Submission detection support + + Additional Requirements : Digest::MD5 2.09 Mon Jan 25 22:00:00 2005 Fixes: diff --git a/Makefile.PL b/Makefile.PL index 1af730e..dbb6545 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -25,6 +25,7 @@ WriteMakefile( Template => 0, Template::Plugin::Class => 0, Test::MockModule => 0, + Digest::MD5 => 0, }, # e.g., Module::Name => 1.1 ( $] >= 5.005 diff --git a/lib/Maypole.pm b/lib/Maypole.pm index cb5e50e..536e1a6 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -222,6 +222,13 @@ sub send_output { die "Do not use Maypole directly; use Apache::MVC or similar"; } +# Session and Repeat Submission Handling + +sub make_random_id { + use Maypole::Session; + return Maypole::Session::generate_unique_id(); +} + =head1 NAME Maypole - MVC web application framework @@ -464,6 +471,9 @@ This method first checks if the relevant model class can handle exceptions the user, or falls back to the default exception method of your Maypole application. +=head3 make_random_id + +returns a unique id for this request can be used to prevent or detect repeat submissions. =head3 handler diff --git a/templates/factory/addnew b/templates/factory/addnew index 142dde6..aec9fca 100644 --- a/templates/factory/addnew +++ b/templates/factory/addnew @@ -35,6 +35,7 @@ table. [% END; %] + diff --git a/templates/factory/edit b/templates/factory/edit index a7c6630..6bdad79 100644 --- a/templates/factory/edit +++ b/templates/factory/edit @@ -26,11 +26,12 @@ form similar to L but with the current values filled in. IF errors.$col; ''; errors.$col;''; END; - END; - ''; - ""; - END %] + + + + + [% END %] [% ELSE %] [% INCLUDE addnew %] [% END %] -- 2.39.5