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:
parent
1b9885f274
commit
f5162189dd
|
@ -98,4 +98,4 @@ class AuthenticationController extends ActionController
|
|||
}
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue