当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_Password::setOptions方法代码示例

本文整理汇总了PHP中Zend_Form_Element_Password::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Password::setOptions方法的具体用法?PHP Zend_Form_Element_Password::setOptions怎么用?PHP Zend_Form_Element_Password::setOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_Password的用法示例。


在下文中一共展示了Zend_Form_Element_Password::setOptions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     // $this->t = Zend_Registry::get('Zend_Translate');
     $username->setOptions(array('label' => $this->t('Username'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($username);
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => $this->t('Password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($password);
     $authentification = new LoginAttempt();
     if ($authentification->canAttemptToLogin() == FALSE) {
         $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->t("no humain"), 'captcha' => array("captcha" => "Image", "wordLen" => 4, "font" => "font/tahoma.ttf", "height" => 100, "width" => 300, "fontSize" => 50, "imgDir" => "data/captchas", "imgUrl" => "data/captchas")));
         $this->addElement($captcha);
     }
     $connexion = new Zend_Form_Element_Submit('Connexion');
     $connexion->setOptions(array('label' => $this->t('Log In')));
     $connexion->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'openOnly' => true))));
     $this->addElement($connexion);
     $inscription = new Zend_Form_Element_Submit('inscription');
     $inscription->setOptions(array('label' => $this->t('Sign Up')));
     $inscription->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'closeOnly' => true))));
     $this->addElement($inscription);
     $this->clearDecorators();
 }
开发者ID:omusico,项目名称:logica,代码行数:34,代码来源:LoginForm.php

示例2: init

 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $userid = new Zend_Form_Element_Hidden('UserID');
     $username = new Zend_Form_Element_Text('Username');
     $username->setOptions(array('label' => 'Username', 'required' => TRUE, 'filters' => array('StringTrim')));
     $password = new Zend_Form_Element_Password('Password');
     $password->setOptions(array('label' => 'Password', 'required' => TRUE));
     $repassword = new Zend_Form_Element_Password('RePassword');
     $repassword->setOptions(array('label' => 'Retype Password', 'required' => TRUE));
     $role = new Zend_Form_Element_Hidden('Role');
     $fullname = new Zend_Form_Element_Text('FullName');
     $fullname->setOptions(array('label' => 'FullName'));
     $email = new Zend_Form_Element_Text('Email');
     $email->setOptions(array('label' => 'Email', 'required' => TRUE));
     $birthday = new Zend_Form_Element_Text("Birthday");
     $birthday->setOptions(array('label' => 'Birthday'));
     $group = new Zend_Form_Element_Text('Group');
     $group->setOptions(array('label' => 'Group'));
     $phone = new Zend_Form_Element_Text('Phone');
     $phone->setOptions(array('label' => 'Phone'));
     $address = new Zend_Form_Element_Text('Address');
     $address->setOptions(array('label' => 'Address'));
     $submit = new Zend_Form_Element_Submit('Submit');
     $this->setName('profile-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $password, $repassword, $role, $fullname, $email, $birthday, $group, $phone, $address, $submit))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form'));
 }
开发者ID:laiello,项目名称:mock-project,代码行数:28,代码来源:Profile.php

示例3: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $user = Zend_Auth::getInstance()->getIdentity();
     $oldPasswordValidator = new App_Validate_PasswordExists(array('table' => 'backoffice_users', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkValue' => $user->id));
     $complexityValidator = new Zend_Validate_Regex('/^(?=.*\\d)(?=.*[a-z|A-Z]).{7,}$/');
     $complexityValidator->setMessage('The selected password does not meet the required complexity requirements');
     $stringLengthValidator = new Zend_Validate_StringLength();
     $stringLengthValidator->setMin(7);
     $stringLengthValidator->setMessage('Your password must be at least 7 characters long');
     $passwordHistoryValidator = new App_Validate_NoPasswordExists(array('table' => 'password_log', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkField' => 'user_id', 'userPkValue' => $user->id));
     $oldPassword = new Zend_Form_Element_Password('old_password');
     $oldPassword->setOptions(array('label' => $this->t('Old password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $oldPasswordValidator)));
     $this->addElement($oldPassword);
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => $this->t('New password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $stringLengthValidator, $complexityValidator, $passwordHistoryValidator)));
     $this->addElement($password);
     $sameAsValidator = new App_Validate_SameAs($password);
     $sameAsValidator->setMessage('The two passwords do not coincide.', App_Validate_SameAs::NOT_THE_SAME);
     $retypeNewPassword = new Zend_Form_Element_Password('retype_new_password');
     $retypeNewPassword->setOptions(array('label' => $this->t('Retype new password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $sameAsValidator)));
     $this->addElement($retypeNewPassword);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => $this->t('Save password'), 'required' => TRUE));
     $this->addElement($submit);
 }
开发者ID:omusico,项目名称:logica,代码行数:35,代码来源:ChangePasswordForm.php

示例4: init

 public function init()
 {
     // Set request method
     $this->setMethod('post');
     // Email entry
     $this->addElement('span', 'email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'formvalue', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address'))))));
     // Modify email error messages & add validator
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
     $this->getElement('email')->addValidator($emailValidator);
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('Create your password');
     $passwordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Re-enter password');
     $confirmPasswordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $securityQuestionModel = new Datasource_Core_SecurityQuestion();
     $securityQuestionOptions = array(0 => '- Please Select -');
     foreach ($securityQuestionModel->getOptions() as $option) {
         $securityQuestionOptions[$option['id']] = $option['question'];
     }
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => false, 'multiOptions' => $securityQuestionOptions, 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))));
     /* Value no longer mandatory, Redmine #11873
             $questionElement = $this->getElement('security_question');
             $validator = new Zend_Validate_GreaterThan(array('min'=> 0));
             $validator->setMessage('You must select a security question');
             $questionElement->addValidator($validator);
     */
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => false, 'filters' => array('StringTrim')));
     // Set custom subform decorator - this is the default and gets overridden by view scripts in the tenants' and landlords' Q&Bs
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/register.phtml'))));
     // Set element decorators
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
     // Grab view and add the client-side password validation JavaScript into the page head
     $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
     $view->headScript()->appendFile('/assets/common/js/passwordValidation.js', 'text/javascript');
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:52,代码来源:Register.php

示例5: init

 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $username = new Zend_Form_Element_Text('username');
     $username->setOptions(array('label' => 'Username', 'required' => TRUE, 'filters' => array('StringTrim')));
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => 'Password', 'required' => TRUE));
     $login = new Zend_Form_Element_Submit('login');
     $login->setOptions(array('label' => 'Login'));
     $this->setName('login-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($username, $password, $login))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form'));
 }
开发者ID:laiello,项目名称:mock-project,代码行数:13,代码来源:Login.php

示例6: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => $this->t('Password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($password);
     $retypePassword = new Zend_Form_Element_Password('retypePassword');
     $retypePassword->setOptions(array('label' => $this->t('Retype password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($retypePassword);
     $this->addDisplayGroup(array('password', 'retypePassword'), 'passwords')->getDisplayGroup('passwords')->setLegend('Password');
 }
开发者ID:omusico,项目名称:logica,代码行数:20,代码来源:UserAddForm.php

示例7: getLoginForm

 /**
  * Create and return the login form
  *
  * @return object
  */
 protected function getLoginForm()
 {
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username:')->setRequired(true)->setDecorators(array(array('ViewScript', array('viewScript' => '_form/text.phtml', 'placement' => false))));
     $username->setOptions(array('placeholder' => 'username...', 'inputtype' => 'text'));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password:')->setRequired(true)->setDecorators(array(array('ViewScript', array('viewScript' => '_form/text.phtml', 'placement' => false))));
     $password->setOptions(array('placeholder' => 'password...', 'inputtype' => 'password'));
     $submit = new Zend_Form_Element_Submit('login');
     $submit->setLabel('Login');
     $loginForm = new Zend_Form();
     $loginForm->setAction($this->_request->getBaseUrl() . '/login/index/')->setMethod('post')->addElement($username)->addElement($password)->addElement($submit);
     return $loginForm;
 }
开发者ID:rapsli,项目名称:404crawler,代码行数:19,代码来源:AuthController.php

示例8: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($username);
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => 'Password', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($password);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => 'Log in →', 'required' => true));
     $this->addElement($submit);
 }
开发者ID:omusico,项目名称:logica,代码行数:22,代码来源:LoginForm.php


注:本文中的Zend_Form_Element_Password::setOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。