Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony]formularze i csrf
prohol
post 6.03.2009, 14:55:08
Post #1





Grupa: Zarejestrowani
Postów: 56
Pomógł: 2
Dołączył: 20.07.2007

Ostrzeżenie: (0%)
-----


witam

Mam problem z formularzami, tzn dokladniej z ochrona przez csrf. (symfony 1.2.4)

Przyusuwaniu kategori z formularza edycji dostaje blad o wymaganym csrf

500 | Internal Server Error | sfValidatorErrorSchema
_csrf_token [Required.]
stack trace
..

Formularze wygenerowalem za pomoca cli. Obecnie plik formluarza wyglada tak:
  1. <?php
  2. class BaseJmdataCategoriesForm extends BaseFormPropel
  3. {
  4.  public function setup()
  5.  {
  6.    
  7.    $this->setWidgets(array(
  8.      'id'    => new sfWidgetFormInputHidden(),
  9.      'name'  => new sfWidgetFormInput(),
  10.      'categories' => new sfWidgetFormPropelChoice(array('model'=>'JmdataCategories', 'add_empty'=> false)),
  11.      'link'  => new sfWidgetFormInput(),
  12.    ));
  13.  
  14.   /* $this->setValidators(array(
  15.       'id'    => new sfValidatorPropelChoice(array('model' => 'JmdataCategories', 'column' => 'id', 'required' => false)),
  16.       
  17.       'name'  => new sfValidatorString(array('max_length' => 150, 'required' => false)),
  18.       'link'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
  19.     ));
  20.     */
  21.  
  22.    $this->widgetSchema->setNameFormat('%s');
  23.    $this->disableCSRFProtection();
  24.  
  25.    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
  26.  
  27.    parent::setup();
  28.  }
  29.  
  30.  public function getModelName()
  31.  {
  32.    return 'JmdataCategories';
  33.  }
  34.  
  35. }
  36. ?>


Pliku JmdataCategoriesForm.class.php jest pusty, tzn bez dodatkowych ustawien itp.

Jak widac wylaczylem CSRFProtection oraz zakomentowalem validatory. Mimo to przy usuwaniu elementu dostaje powyzszy komunikat. Gdy wlacze CSRF to komunikat o wymaganym csrf token dostaje przy dodawaniu/edycji pol. Szukalem na forum symfony i nic nie pomagalo. Prosze o pomoc.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 26.06.2025 - 20:42