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


PHP Default_Model_Users::getLoggedInUserPwd方法代码示例

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


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

示例1: editpasswordAction

 public function editpasswordAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $identity = $auth->getIdentity();
         $id = $identity->id;
         $email = $identity->emailaddress;
         $employeid = $identity->employeeId;
     }
     $password = trim($this->_request->getParam('password'));
     $newpassword = trim($this->_request->getParam('newpassword'));
     $confpassword = trim($this->_request->getParam('passwordagain'));
     $password = preg_replace('/\\s+/', ' ', $password);
     $newpassword = preg_replace('/\\s+/', ' ', $newpassword);
     $confpassword = preg_replace('/\\s+/', ' ', $confpassword);
     $pwd = md5($password);
     $newpwd = md5($newpassword);
     $confpwd = md5($confpassword);
     $loginmodel = new Default_Model_Users();
     $userpassword = $loginmodel->getLoggedInUserPwd($id, $email, $employeid);
     $sespwd = $userpassword['emppassword'];
     $changepasswordform = new Default_Form_changepassword();
     $sitepreferencemodel = new Default_Model_Sitepreference();
     $sitepreferenceArr = $sitepreferencemodel->SitePreferanceData();
     /*
         Pattern Used for alphanumeric expression 
     	   'pattern'=> '/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/',
     		  -> Here the first bracket() inside the pattern specifies that atleast one number should be there in the expression.
     		  -> Second bracket() specifies that atleast one alphabet should be present in the expression.
     		  -> Third bracket() specifies the allowed set of characters in the expression.
     		  
     	Pattern Used for alphanumeric and special characters 
     	    'pattern'=> '/^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[.\-#$@&\_*])([a-zA-Z0-9.\-#$@&\_*]+)$/',
     		  -> Here the first bracket() inside the pattern specifies that atleast one number should be there in the expression.
     		  -> Second bracket() specifies that atleast one alphabet should be present in the expression.
     		  -> Third bracket() specifies that atleast one special character should be present in the expression.
     		  -> Fourth bracket() specifies the allowed set of characters in the expression.
     
                 Pattern Used for numbers and special characters 
     	    'pattern'=> '/^(?=.*[0-9])(?=.*[.\-#$@&\_*])([0-9.\-#$@&\_*]+)$/',
     		  -> Here the first bracket() inside the pattern specifies that atleast one number should be there in the expression.
     		  -> Second bracket() specifies that atleast one special character should be present in the expression.
     		  -> Third bracket() specifies the allowed set of characters in the expression.				  
     */
     if (!empty($sitepreferenceArr)) {
         if ($sitepreferenceArr[0]['passwordid'] == 1) {
             $changepasswordform->newpassword->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only alphanumeric characters.')));
             $changepasswordform->passwordagain->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only alphanumeric characters.')));
         } else {
             if ($sitepreferenceArr[0]['passwordid'] == 2) {
                 $changepasswordform->newpassword->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[.\\-#$@&\\_*])([a-zA-Z0-9.\\-#$@&\\_*]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only characters,numbers and special characters.')));
                 $changepasswordform->passwordagain->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[.\\-#$@&\\_*])([a-zA-Z0-9.\\-#$@&\\_*]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only characters,numbers and special characters.')));
             } else {
                 if ($sitepreferenceArr[0]['passwordid'] == 3) {
                     $changepasswordform->newpassword->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter numbers only.')));
                     $changepasswordform->passwordagain->addValidator("regex", true, array('pattern' => '/^[0-9]+$/', 'messages' => array('regexNotMatch' => 'Please enter numbers only.')));
                 } else {
                     $changepasswordform->newpassword->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[.\\-#$@&\\_*])([0-9.\\-#$@&\\_*]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers and special characters.')));
                     $changepasswordform->passwordagain->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[.\\-#$@&\\_*])([0-9.\\-#$@&\\_*]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only numbers and special characters.')));
                 }
             }
         }
     } else {
         $changepasswordform->newpassword->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only alphanumeric characters.')));
         $changepasswordform->passwordagain->addValidator("regex", true, array('pattern' => '/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/', 'messages' => array('regexNotMatch' => 'Please enter only alphanumeric characters.')));
     }
     /* Logic ends for site preference password validation
           END
        */
     if ($this->getRequest()->getPost()) {
         if ($changepasswordform->isValid($this->_request->getPost()) && $sespwd == $pwd && $newpwd == $confpwd && $pwd != $newpwd) {
             $loginmodel->editadminPassword($newpwd, $id, $email, $employeid);
             $this->_helper->json(array('result' => 'saved', 'message' => "Password changed successfully."));
         } else {
             $messages = $changepasswordform->getMessages();
             if ($sespwd != $pwd && $password != '') {
                 $messages['password'] = array('Wrong password. Please enter correct password.');
             }
             if ($newpwd != $confpwd && $newpassword != '' && $confpassword != '') {
                 $messages['passwordagain'] = array('New password and confirm password did not match.');
             }
             if ($pwd == $newpwd && $newpassword != '' && $password != '') {
                 $messages['passwordagain'] = array('Please choose a different password.');
             }
             $messages['result'] = 'error';
             $this->_helper->json($messages);
         }
     }
 }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:89,代码来源:DashboardController.php


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