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


PHP ModuleUser_EntityUser::setPassword方法代码示例

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


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

示例1: EventAccount

 /**
  * Форма смены пароля, емайла
  */
 protected function EventAccount()
 {
     /**
      * Устанавливаем title страницы
      */
     E::ModuleViewer()->AddHtmlTitle(E::ModuleLang()->Get('settings_menu_profile'));
     $this->sMenuSubItemSelect = 'account';
     /**
      * Если нажали кнопку "Сохранить"
      */
     if (isPost('submit_account_edit')) {
         E::ModuleSecurity()->ValidateSendForm();
         $bError = false;
         /**
          * Проверка мыла
          */
         if (F::CheckVal(F::GetRequestStr('mail'), 'mail')) {
             if (($oUserMail = E::ModuleUser()->GetUserByMail(F::GetRequestStr('mail'))) && $oUserMail->getId() != $this->oUserCurrent->getId()) {
                 E::ModuleMessage()->AddError(E::ModuleLang()->Get('settings_profile_mail_error_used'), E::ModuleLang()->Get('error'));
                 $bError = true;
             }
         } else {
             E::ModuleMessage()->AddError(E::ModuleLang()->Get('settings_profile_mail_error'), E::ModuleLang()->Get('error'));
             $bError = true;
         }
         /**
          * Проверка на смену пароля
          */
         if ($sPassword = $this->GetPost('password')) {
             if (($nMinLen = Config::Get('module.security.password_len')) < 3) {
                 $nMinLen = 3;
             }
             if (F::CheckVal($sPassword, 'password', $nMinLen)) {
                 if ($sPassword == $this->GetPost('password_confirm')) {
                     if (E::ModuleSecurity()->CheckSalted($this->oUserCurrent->getPassword(), $this->GetPost('password_now'), 'pass')) {
                         $this->oUserCurrent->setPassword($sPassword, true);
                     } else {
                         $bError = true;
                         E::ModuleMessage()->AddError(E::ModuleLang()->Get('settings_profile_password_current_error'), E::ModuleLang()->Get('error'));
                     }
                 } else {
                     $bError = true;
                     E::ModuleMessage()->AddError(E::ModuleLang()->Get('settings_profile_password_confirm_error'), E::ModuleLang()->Get('error'));
                 }
             } else {
                 $bError = true;
                 E::ModuleMessage()->AddError(E::ModuleLang()->Get('settings_profile_password_new_error', array('num' => $nMinLen)), E::ModuleLang()->Get('error'));
             }
         }
         /**
          * Ставим дату последнего изменения
          */
         $this->oUserCurrent->setProfileDate(F::Now());
         /**
          * Запускаем выполнение хуков
          */
         E::ModuleHook()->Run('settings_account_save_before', array('oUser' => $this->oUserCurrent, 'bError' => &$bError));
         /**
          * Сохраняем изменения
          */
         if (!$bError) {
             if (E::ModuleUser()->Update($this->oUserCurrent)) {
                 E::ModuleMessage()->AddNoticeSingle(E::ModuleLang()->Get('settings_account_submit_ok'));
                 /**
                  * Подтверждение смены емайла
                  */
                 if (F::GetRequestStr('mail') && F::GetRequestStr('mail') != $this->oUserCurrent->getMail()) {
                     if ($oChangemail = E::ModuleUser()->MakeUserChangemail($this->oUserCurrent, F::GetRequestStr('mail'))) {
                         if ($oChangemail->getMailFrom()) {
                             E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('settings_profile_mail_change_from_notice'));
                         } else {
                             E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('settings_profile_mail_change_to_notice'));
                         }
                     }
                 }
                 E::ModuleHook()->Run('settings_account_save_after', array('oUser' => $this->oUserCurrent));
             } else {
                 E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'));
             }
         }
     }
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:85,代码来源:ActionSettings.class.php

示例2: EventAccount

 /**
  * Форма смены пароля, емайла
  */
 protected function EventAccount()
 {
     /**
      * Устанавливаем title страницы
      */
     $this->Viewer_AddHtmlTitle($this->Lang_Get('settings_menu_profile'));
     $this->sMenuSubItemSelect = 'account';
     /**
      * Если нажали кнопку "Сохранить"
      */
     if (isPost('submit_account_edit')) {
         $this->Security_ValidateSendForm();
         $bError = false;
         /**
          * Проверка мыла
          */
         if (func_check(getRequestStr('mail'), 'mail')) {
             if ($oUserMail = $this->User_GetUserByMail(getRequestStr('mail')) and $oUserMail->getId() != $this->oUserCurrent->getId()) {
                 $this->Message_AddError($this->Lang_Get('settings_profile_mail_error_used'), $this->Lang_Get('error'));
                 $bError = true;
             }
         } else {
             $this->Message_AddError($this->Lang_Get('settings_profile_mail_error'), $this->Lang_Get('error'));
             $bError = true;
         }
         /**
          * Проверка на смену пароля
          */
         if (getRequestStr('password', '') != '') {
             if (func_check(getRequestStr('password'), 'password', 5)) {
                 if (getRequestStr('password') == getRequestStr('password_confirm')) {
                     if (func_encrypt(getRequestStr('password_now')) == $this->oUserCurrent->getPassword()) {
                         $this->oUserCurrent->setPassword(func_encrypt(getRequestStr('password')));
                     } else {
                         $bError = true;
                         $this->Message_AddError($this->Lang_Get('settings_profile_password_current_error'), $this->Lang_Get('error'));
                     }
                 } else {
                     $bError = true;
                     $this->Message_AddError($this->Lang_Get('settings_profile_password_confirm_error'), $this->Lang_Get('error'));
                 }
             } else {
                 $bError = true;
                 $this->Message_AddError($this->Lang_Get('settings_profile_password_new_error'), $this->Lang_Get('error'));
             }
         }
         /**
          * Ставим дату последнего изменения
          */
         $this->oUserCurrent->setProfileDate(date("Y-m-d H:i:s"));
         /**
          * Запускаем выполнение хуков
          */
         $this->Hook_Run('settings_account_save_before', array('oUser' => $this->oUserCurrent, 'bError' => &$bError));
         /**
          * Сохраняем изменения
          */
         if (!$bError) {
             if ($this->User_Update($this->oUserCurrent)) {
                 $this->Message_AddNoticeSingle($this->Lang_Get('settings_account_submit_ok'));
                 /**
                  * Подтверждение смены емайла
                  */
                 if (getRequestStr('mail') and getRequestStr('mail') != $this->oUserCurrent->getMail()) {
                     if ($oChangemail = $this->User_MakeUserChangemail($this->oUserCurrent, getRequestStr('mail'))) {
                         if ($oChangemail->getMailFrom()) {
                             $this->Message_AddNotice($this->Lang_Get('settings_profile_mail_change_from_notice'));
                         } else {
                             $this->Message_AddNotice($this->Lang_Get('settings_profile_mail_change_to_notice'));
                         }
                     }
                 }
                 $this->Hook_Run('settings_account_save_after', array('oUser' => $this->oUserCurrent));
             } else {
                 $this->Message_AddErrorSingle($this->Lang_Get('system_error'));
             }
         }
     }
 }
开发者ID:cbrspc,项目名称:LIVESTREET-1-DISTRIB,代码行数:82,代码来源:ActionSettings.class.php


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