public function insertBrick(HTML_QuickForm2_Container $form) { $len = Am_Di::getInstance()->config->get('pass_min_length', 6); if (!$this->getConfig('do_not_ask_current_pass')) { $oldPass = $form->addPassword('_oldpass', array('size' => 30, 'autocomplete' => 'off'))->setLabel($this->___("Your Current Password\nif you are changing password, please\n enter your current password for validation")); $oldPass->addRule('callback2', 'wrong', array($this, 'validateOldPass')); } $pass = $form->addPassword('pass', array('size' => 30, 'autocomplete' => 'off', 'maxlength' => Am_Di::getInstance()->config->get('pass_max_length', 64)))->setLabel($this->___("New Password\nyou can choose new password here or keep it unchanged\nmust be %d or more characters", $len)); $pass->addRule('length', sprintf($this->___('Password must contain at least %d letters or digits'), $len), array($len, Am_Di::getInstance()->config->get('pass_max_length', 64))); if (Am_Di::getInstance()->config->get('require_strong_password')) { $pass->addRule('regex', $this->___('Password should contain at least 2 capital letters, 2 or more numbers and 2 or more special chars'), Am_Di::getInstance()->userTable->getStrongPasswordRegex()); } if (!$this->getConfig('do_not_confirm')) { $pass0 = $form->addPassword('_pass', array('size' => 30, 'autocomplete' => 'off'))->setLabel($this->___('Confirm New Password'))->setId('pass-confirm'); $pass0->addRule('eq', $this->___('Password and Password Confirmation are different. Please reenter both'), $pass); if ($this->getConfig('do_not_allow_copy_paste')) { $form->addScript()->setScript(' jQuery(function($){ $("#pass-confirm").bind("paste", function() { return false; }) })'); } return array($pass, $pass0); } return $pass; }
public function insertBrick(HTML_QuickForm2_Container $form) { $forSignup = true; $len = Am_Di::getInstance()->config->get('pass_min_length', 6); $oldPass = $form->addPassword('_oldpass', array('size' => 15))->setLabel($this->___("Your Current Password\nif you are changing password, please\n enter your current password for validation")); $oldPass->addRule('callback2', 'wrong', array($this, 'validateOldPass')); $pass = $form->addPassword('pass', array('size' => 15, 'maxlength' => Am_Di::getInstance()->config->get('pass_max_length', 64)))->setLabel($this->___("New Password\nyou can choose new password here or keep it unchanged\nmust be %d or more characters", $len)); $pass0 = $form->addPassword('_pass', array('size' => 15))->setLabel($this->___('Confirm New Password')); $pass->addRule('length', sprintf($this->___('Password must contain at least %d letters or digits'), $len), array($len, Am_Di::getInstance()->config->get('pass_max_length', 64))); $pass0->addRule('eq', $this->___('Password and Password Confirmation are different. Please reenter both'), $pass); return array($pass, $pass0); }