parent
c6ebe85782
commit
e9c9c9de87
|
@ -71,6 +71,7 @@ class AuthenticationController extends ActionController
|
|||
|
||||
if ($this->getRequest()->isPost() && $this->view->form->isValid($this->getRequest())) {
|
||||
|
||||
|
||||
$credentials->setUsername($this->view->form->getValue('username'));
|
||||
$credentials->setPassword($this->view->form->getValue('password'));
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class LoginForm extends Form
|
|||
'required' => true
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'password',
|
||||
'password',
|
||||
|
@ -53,6 +54,7 @@ class LoginForm extends Form
|
|||
'required' => true
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement(
|
||||
'submit',
|
||||
'submit',
|
||||
|
@ -61,6 +63,7 @@ class LoginForm extends Form
|
|||
'class' => 'pull-right'
|
||||
)
|
||||
);
|
||||
|
||||
$this->disableCsrfToken();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,12 @@ abstract class Form extends \Zend_Form
|
|||
*/
|
||||
private $tokenTimeout = 300;
|
||||
|
||||
/**
|
||||
* Flag to indicate that form is already build
|
||||
* @var bool
|
||||
*/
|
||||
private $created = false;
|
||||
|
||||
/**
|
||||
* @see Zend_Form::init
|
||||
*/
|
||||
|
@ -71,16 +77,15 @@ abstract class Form extends \Zend_Form
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the form to html
|
||||
* @param Zend_View_Interface $view
|
||||
* @return string
|
||||
*/
|
||||
public function render(Zend_View_Interface $view = null)
|
||||
{
|
||||
if ($this->_isRendered === false) {
|
||||
$this->create();
|
||||
|
||||
// Empty action if not safe
|
||||
if (!$this->getAction() && $this->getRequest()) {
|
||||
$this->setAction($this->getRequest()->getRequestUri());
|
||||
}
|
||||
}
|
||||
// Elements must be there to render the form
|
||||
$this->buildForm();
|
||||
return parent::render($view);
|
||||
}
|
||||
|
||||
|
@ -107,6 +112,23 @@ abstract class Form extends \Zend_Form
|
|||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers form creation
|
||||
*/
|
||||
public function buildForm()
|
||||
{
|
||||
if ($this->created === false) {
|
||||
$this->create();
|
||||
|
||||
// Empty action if not safe
|
||||
if (!$this->getAction() && $this->getRequest()) {
|
||||
$this->setAction($this->getRequest()->getRequestUri());
|
||||
}
|
||||
|
||||
$this->created = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if data from array or request is valid
|
||||
*
|
||||
|
@ -119,6 +141,9 @@ abstract class Form extends \Zend_Form
|
|||
{
|
||||
$check = null;
|
||||
|
||||
// Elements must be there to validate
|
||||
$this->buildForm();
|
||||
|
||||
if ($data === null) {
|
||||
$check = $this->getRequest()->getParams();
|
||||
} elseif ($data instanceof \Zend_Controller_Request_Abstract) {
|
||||
|
|
Loading…
Reference in New Issue