]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Making FormAction subclasses use same sessionToken() code
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 18 May 2014 17:59:40 +0000 (19:59 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 18 May 2014 17:59:40 +0000 (19:59 +0200)
lib/disfavorform.php
lib/favorform.php
lib/form.php
lib/repeatform.php

index d91ad1b61c468d7dd8fa2ca35461d8ae53538056..51903b6cb2d9d61c0f3e0c2bd5e3e9972602199d 100644 (file)
@@ -84,18 +84,6 @@ class DisfavorForm extends Form
         return common_local_url('disfavor');
     }
 
-    /**
-     * Include a session token for CSRF protection
-     *
-     * @return void
-     */
-    function sessionToken()
-    {
-        $this->out->hidden('token-' . $this->notice->id,
-                           common_session_token(),
-                           'token');
-    }
-
     /**
      * Legend of the Form
      *
index ebf1b5ffc99d98d110c55d2439051feed0b8cd25..cd956f67ff27ffde0c8876366c21be5fda0ef73d 100644 (file)
@@ -84,18 +84,6 @@ class FavorForm extends Form
         return common_local_url('favor');
     }
 
-    /**
-     * Include a session token for CSRF protection
-     *
-     * @return void
-     */
-    function sessionToken()
-    {
-        $this->out->hidden('token-' . $this->notice->id,
-                           common_session_token(),
-                           'token');
-    }
-
     /**
      * Legend of the Form
      *
index 74737f6df5c12953dbc6f71f0bfd90358f499971..6a181f79513856678f3a1c1659dd08772c5a8196 100644 (file)
@@ -91,7 +91,7 @@ class Form extends Widget
 
     function sessionToken()
     {
-        $this->out->hidden('token', common_session_token());
+        $this->out->hidden('token-' . $this->id() ?: common_random_hexstr(3), common_session_token(), 'token');
     }
 
     /**
index 67fc47b8de59ddb1f22d72454943483d4c92b2c3..f0ce37fb62db07fc0798400d9cbb051c0917ba4c 100644 (file)
@@ -80,17 +80,6 @@ class RepeatForm extends Form
         return common_local_url('repeat');
     }
 
-    /**
-     * Include a session token for CSRF protection
-     *
-     * @return void
-     */
-    function sessionToken()
-    {
-        $this->out->hidden('token-' . $this->notice->id,
-                           common_session_token());
-    }
-
     /**
      * Legend of the Form
      *