Implement dynamic form elements

Rename "isPostAndValid" to "isSubmittedAndValid" and refactor it.
Add possibility for specific form elements to auto-submit their form.

refs #4439
This commit is contained in:
Johannes Meyer 2013-08-02 16:35:16 +02:00 committed by Jannis Moßhammer
parent 1b9885f274
commit f5162189dd
2 changed files with 6 additions and 5 deletions

View File

@ -98,4 +98,4 @@ class AuthenticationController extends ActionController
}
}
// @codingStandardsIgnoreEnd
// @codingStandardsIgnoreEnd

View File

@ -295,8 +295,12 @@ abstract class Form extends Zend_Form
if ($submitted) {
$this->preValidation($checkData);
return $this->isValid($checkData);
} else {
$this->populate($checkData);
return false;
}
return parent::isValid($checkData) && $submitted;
}
/**
@ -373,8 +377,6 @@ abstract class Form extends Zend_Form
return false;
}
$seed -= intval(time() / $this->tokenTimeout) * $this->tokenTimeout;
return $token === hash('sha256', $this->getSessionId() . $seed);
}
@ -386,7 +388,6 @@ abstract class Form extends Zend_Form
{
$seed = mt_rand();
$hash = hash('sha256', $this->getSessionId() . $seed);
$seed += intval(time() / $this->tokenTimeout) * $this->tokenTimeout;
return array($seed, $hash);
}