Beispiel #1
0
 /**
  * Returns the login form
  * @return Sydney_Form
  */
 private function getLoginForm($renewalPassword = false)
 {
     $r = $this->getRequest();
     if (isset($r->redirectmodule)) {
         $action = '/default/login/process/redirectmodule/' . $r->getParam('redirectmodule', 'admindashboard');
     } elseif (isset($r->redirectpage)) {
         $action = '/default/login/process/redirectpage/' . $r->redirectpage;
     } elseif (substr($r->module, 0, 5) == 'admin') {
         $module = $r->module;
         if ('admin' == $module) {
             $module = 'admindashboard';
         }
         $this->setLayoutLoginAdmin();
         $action = '/default/login/process/redirectmodule/' . $module;
     } elseif (null != $r->getParam('page', null)) {
         $action = '/default/login/process/redirectpage/' . $r->getParam('page');
     } else {
         $action = '/default/login/process/';
     }
     $config = new Zend_Config_Ini(__DIR__ . '/../config/default.login.index.ini', 'loginform');
     $form = new Sydney_Form($config);
     $form->setAction($action);
     // Set decorator to checkbox element 'Remember Me'
     $form->addPrefixPath('Sydney_Decorator', 'Sydney/Decorator/', 'decorator');
     $form->addElementPrefixPath('Sydney_Decorator', 'Sydney/Decorator/', 'decorator');
     $form->getElement('rememberme')->setDecorators(array('CheckboxloginDecorator'));
     /**/
     // Check concurrent access
     // if params MaxLogin exist then check the number of session
     $this->view->maxLoginExceeded = false;
     if ($renewalPassword) {
         $form->setDescription(Sydney_Tools::_('Your password has expired. Please change it!'));
         // clone submit
         $submit = clone $form->getElement('submit');
         $form->removeElement('submit');
         // clone remember me
         $rememberme = clone $form->getElement('rememberme');
         $form->removeElement('rememberme');
         // clone password
         $newPassword = clone $form->getElement('password');
         $newPassword->setName('new_password');
         $newPassword->setLabel('New password');
         // clone password2
         $confirmNewPassword = clone $form->getElement('password');
         $confirmNewPassword->setName('confirm_new_password');
         $confirmNewPassword->setLabel('Confirm new password');
         $form->addElements(array($newPassword, $confirmNewPassword, $rememberme, $submit));
     }
     return $form;
 }