mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
parent
c6ebe85782
commit
e9c9c9de87
@ -71,6 +71,7 @@ class AuthenticationController extends ActionController
|
|||||||
|
|
||||||
if ($this->getRequest()->isPost() && $this->view->form->isValid($this->getRequest())) {
|
if ($this->getRequest()->isPost() && $this->view->form->isValid($this->getRequest())) {
|
||||||
|
|
||||||
|
|
||||||
$credentials->setUsername($this->view->form->getValue('username'));
|
$credentials->setUsername($this->view->form->getValue('username'));
|
||||||
$credentials->setPassword($this->view->form->getValue('password'));
|
$credentials->setPassword($this->view->form->getValue('password'));
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ class LoginForm extends Form
|
|||||||
'required' => true
|
'required' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'password',
|
'password',
|
||||||
'password',
|
'password',
|
||||||
@ -53,6 +54,7 @@ class LoginForm extends Form
|
|||||||
'required' => true
|
'required' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'submit',
|
'submit',
|
||||||
'submit',
|
'submit',
|
||||||
@ -61,6 +63,7 @@ class LoginForm extends Form
|
|||||||
'class' => 'pull-right'
|
'class' => 'pull-right'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->disableCsrfToken();
|
$this->disableCsrfToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,12 @@ abstract class Form extends \Zend_Form
|
|||||||
*/
|
*/
|
||||||
private $tokenTimeout = 300;
|
private $tokenTimeout = 300;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to indicate that form is already build
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $created = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Zend_Form::init
|
* @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)
|
public function render(Zend_View_Interface $view = null)
|
||||||
{
|
{
|
||||||
if ($this->_isRendered === false) {
|
// Elements must be there to render the form
|
||||||
$this->create();
|
$this->buildForm();
|
||||||
|
|
||||||
// Empty action if not safe
|
|
||||||
if (!$this->getAction() && $this->getRequest()) {
|
|
||||||
$this->setAction($this->getRequest()->getRequestUri());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return parent::render($view);
|
return parent::render($view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +112,23 @@ abstract class Form extends \Zend_Form
|
|||||||
return $this->request;
|
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
|
* Test if data from array or request is valid
|
||||||
*
|
*
|
||||||
@ -119,6 +141,9 @@ abstract class Form extends \Zend_Form
|
|||||||
{
|
{
|
||||||
$check = null;
|
$check = null;
|
||||||
|
|
||||||
|
// Elements must be there to validate
|
||||||
|
$this->buildForm();
|
||||||
|
|
||||||
if ($data === null) {
|
if ($data === null) {
|
||||||
$check = $this->getRequest()->getParams();
|
$check = $this->getRequest()->getParams();
|
||||||
} elseif ($data instanceof \Zend_Controller_Request_Abstract) {
|
} elseif ($data instanceof \Zend_Controller_Request_Abstract) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user