Include CSRF tokens by default in every non-GET form. #917.
This commit is contained in:
1 parent
43a9724d02
commit
0fcbd4466f
1 file changed
+14
-3
+14
-3
@@ -705,14 +705,25 @@ class FormBuilder {
|
|||||||
*/
|
*/
|
||||||
protected function getAppendage($method)
|
protected function getAppendage($method)
|
||||||
{
|
{
|
||||||
$method = strtoupper($method);
|
list($method, $appendage) = array(strtoupper($method), '');
|
||||||
|
|
||||||
|
// If the HTTP method is in this list of spoofed methods, we will attach the
|
||||||
|
// method spoofer hidden input to the form. This allows us to use regular
|
||||||
|
// form to initiate PUT and DELETE requests in addition to the typical.
|
||||||
if (in_array($method, $this->spoofedMethods))
|
if (in_array($method, $this->spoofedMethods))
|
||||||
{
|
{
|
||||||
return $this->hidden('_method', $method);
|
$appendage .= $this->hidden('_method', $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
// If the method is something other than GET we will go ahead and attach the
|
||||||
|
// CSRF token to the form, as this can't hurt and is convenient to simply
|
||||||
|
// always have available on every form the developers creates for them.
|
||||||
|
if ($method != 'GET')
|
||||||
|
{
|
||||||
|
$appendage .= $this->token();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $appendage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user