示例#1
0
 function userUpdatePassword()
 {
     $sUsername = $this->get('updatepassword', '');
     if ($sUsername == '') {
         throw new PPI_Exception('Invalid Username');
     }
     $oUser = new APP_Model_User();
     $aUser = $oUser->getRecord('username = '******'Unable to find user information against: ' . $sUsername);
     }
     $iUserID = $aUser[$oUser->getPrimaryKey()];
     $oForm = new PPI_Model_Form();
     $oForm->init('admin_user_updatepassword', '', 'post');
     $oForm->setFormStructure($oUser->getAdminUpdatePasswordFormStructure());
     if ($oForm->isSubmitted()) {
         $aFormValues = $oForm->getSubmitValues();
         if ($aFormValues['password'] !== $aFormValues['password_confirm']) {
             $oForm->setElementError('password_confirm', 'Both passwords must match');
         }
         if ($oForm->isValidated()) {
             $oUser->updatePassword($iUserID, $aFormValues['password']);
             $this->redirect('admin/user');
         }
     }
     $this->adminLoad('admin/user_updatepassword', array('formBuilder' => $oForm->getRenderInformation()));
 }