protected function createForm()
 {
     $form = new Am_Form();
     $form->addCsrf();
     $form->addText('login', array('disabled' => 'disabled'))->setLabel(___('Username'));
     $pass0 = $form->addPassword('pass0')->setLabel(___('New Password'));
     $pass0->addRule('minlength', ___('The password should be at least %d characters long', $this->getDi()->config->get('pass_min_length', 4)), $this->getDi()->config->get('pass_min_length', 4));
     $pass0->addRule('maxlength', ___('Your password is too long'), $this->getDi()->config->get('pass_max_length', 32));
     $pass0->addRule('required', 'This field is required');
     if ($this->getDi()->config->get('require_strong_password')) {
         $pass0->addRule('regex', ___('Password should contain at least 2 capital letters, 2 or more numbers and 2 or more special chars'), $this->getDi()->userTable->getStrongPasswordRegex());
     }
     $pass1 = $form->addPassword('pass1')->setLabel(___('Confirm Password'));
     $pass1->addRule('eq', ___('Passwords do not match'), $pass0);
     $form->addHidden(self::SECURITY_VAR);
     $form->addSaveButton(___('Change Password'));
     return $form;
 }
Beispiel #2
0
 public function createForm()
 {
     $form = new Am_Form();
     $form->addCsrf();
     $form->setAttribute('class', 'am-helpdesk-form');
     return $form;
 }