Created
December 23, 2020 13:55
-
-
Save bernard-ng/19a2d780b658c6478ac9c119854ddcb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
use App\Entity\Task; | |
use Symfony\Component\OptionsResolver\OptionsResolver; | |
class TaskType extends AbstractType | |
{ | |
// ... | |
public function configureOptions(OptionsResolver $resolver) | |
{ | |
$resolver->setDefaults([ | |
'data_class' => Task::class, | |
// activer/désactiver la protection du CSRF pour ce formulaire | |
'csrf_protection' => true, | |
// le nom du champ HTML caché qui stocke le jeton | |
'csrf_field_name' => '_token', | |
// une chaîne arbitraire utilisée pour générer la valeur du jeton | |
// l'utilisation d'une chaîne de caractères différente pour chaque formulaire améliore sa sécurité | |
'csrf_token_id' => 'task_item', | |
]); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment