]> git.decadent.org.uk Git - maypole.git/commitdiff
repeat submission identification
authorAaron Trevena <aaron.trevena@gmail.com>
Tue, 5 Jul 2005 08:04:48 +0000 (08:04 +0000)
committerAaron Trevena <aaron.trevena@gmail.com>
Tue, 5 Jul 2005 08:04:48 +0000 (08:04 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@343 48953598-375a-da11-a14b-00016c27c3ee

Changes
Makefile.PL
lib/Maypole.pm
templates/factory/addnew
templates/factory/edit

diff --git a/Changes b/Changes
index 1ce12ab2200cfb266f279503608cb74ea507b743..4c0ff4a04e425efdf277033e494c2e1c1fb212ae 100644 (file)
--- 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 )
     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:
 
 2.09  Mon Jan 25 22:00:00 2005
     Fixes:
index 1af730eac31a74a38ed9dc1047a5fbe5dcbdab1d..dbb6545947117a6f1ed480cadc5c2e040a84c16a 100644 (file)
@@ -25,6 +25,7 @@ WriteMakefile(
         Template                         => 0,
         Template::Plugin::Class          => 0,
         Test::MockModule                 => 0,
         Template                         => 0,
         Template::Plugin::Class          => 0,
         Test::MockModule                 => 0,
+       Digest::MD5                      => 0,
     },    # e.g., Module::Name => 1.1
     (
         $] >= 5.005
     },    # e.g., Module::Name => 1.1
     (
         $] >= 5.005
index cb5e50ea04f38211eabfdf5787f4053b24a6767f..536e1a6689ac2c0329beb1d43ea4255555c2865d 100644 (file)
@@ -222,6 +222,13 @@ sub send_output {
     die "Do not use Maypole directly; use Apache::MVC or similar";
 }
 
     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
 =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.
 
 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
 
 
 =head3 handler
 
index 142dde6909e2cfbd7327e2c2a4c6009763e83b5c..aec9fca13c86370ee173ef48aca8811d92106eb5 100644 (file)
@@ -35,6 +35,7 @@ table.
 
     [% END; %]
     <input type="submit" name="create" value="create"/>
 
     [% END; %]
     <input type="submit" name="create" value="create"/>
+    <input type="hidden" name="__form_id" value="[% request.make_random_id %]">
 </fieldset>
 </form>
 </div>
 </fieldset>
 </form>
 </div>
index a7c6630f934a11ffaaf79eeb89b1e6ce7eed20bf..6bdad79347cef088c484d66ec30a546387772fb9 100644 (file)
@@ -26,11 +26,12 @@ form similar to L<addnew> but with the current values filled in.
     IF errors.$col; 
        '<span class="error">'; errors.$col;'</span>';
     END;
     IF errors.$col; 
        '<span class="error">'; errors.$col;'</span>';
     END;
-    END;
-    '<input type="submit" name="edit" value="edit"/>';
-    "</fieldset></form>";
-    
     END %]
     END %]
+    <input type="submit" name="edit" value="edit"/>
+    <input type="hidden" name="__form_id" value="[% request.make_random_id %]">
+    </fieldset></form>
+    
+    [% END %]
 [% ELSE %]
 [% INCLUDE addnew %]
 [% END %]
 [% ELSE %]
 [% INCLUDE addnew %]
 [% END %]