Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
adace223
Commit
adace223
authored
Sep 13, 2011
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added SessionCsrfProvider support in FormExtension when SessionExtension is registered
parent
73bb2b07
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
src/Silex/Extension/FormExtension.php
src/Silex/Extension/FormExtension.php
+5
-0
No files found.
src/Silex/Extension/FormExtension.php
View file @
adace223
...
@@ -14,6 +14,7 @@ namespace Silex\Extension;
...
@@ -14,6 +14,7 @@ namespace Silex\Extension;
use
Silex\Application
;
use
Silex\Application
;
use
Silex\ExtensionInterface
;
use
Silex\ExtensionInterface
;
use
Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider
;
use
Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider
;
use
Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider
;
use
Symfony\Component\Form\FormFactory
;
use
Symfony\Component\Form\FormFactory
;
use
Symfony\Component\Form\Extension\Core\CoreExtension
;
use
Symfony\Component\Form\Extension\Core\CoreExtension
;
use
Symfony\Component\Form\Extension\Validator\ValidatorExtension
as
FormValidatorExtension
;
use
Symfony\Component\Form\Extension\Validator\ValidatorExtension
as
FormValidatorExtension
;
...
@@ -44,6 +45,10 @@ class FormExtension implements ExtensionInterface
...
@@ -44,6 +45,10 @@ class FormExtension implements ExtensionInterface
});
});
$app
[
'form.csrf_provider'
]
=
$app
->
share
(
function
()
use
(
$app
)
{
$app
[
'form.csrf_provider'
]
=
$app
->
share
(
function
()
use
(
$app
)
{
if
(
isset
(
$app
[
'session'
]))
{
return
new
SessionCsrfProvider
(
$app
[
'session'
],
$app
[
'form.secret'
]);
}
return
new
DefaultCsrfProvider
(
$app
[
'form.secret'
]);
return
new
DefaultCsrfProvider
(
$app
[
'form.secret'
]);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment