コード例 #1
0
 /**
  * Generates the hash.
  *
  * @author Daniel Seemaier
  * @version
  * Version 0.1, 06.11.2010
  */
 public function onParseTime()
 {
     $class = $this->getAttribute('class');
     $salt = $this->getAttribute('salt');
     if ($salt === null) {
         throw new FormException('[CsrfProtectionHashTag::onParseTime()] The salt attribute is ' . 'not present. Please refer to the documentation concerning the setup of the ' . '<form:csrfhash /> tag!');
     }
     /* @var $provider CSRFHashProvider */
     $provider = $this->getServiceObject($class);
     $this->hash = $provider->generateHash($salt);
     // preset the value to make it available for the validator
     parent::onParseTime();
     // add the csrfhash validator for every button
     $form = $this->getForm();
     $buttons = $form->getFormElementsByTagName('form:button');
     foreach ($buttons as $offset => $DUMMY) {
         $this->addValidator(new CSRFHashValidator($this, $buttons[$offset]));
     }
 }
コード例 #2
0
 public function reset()
 {
     // Delegate reset to the inner text field. Might be without any effect in case clearonformerror=true.
     $this->textField->reset();
 }