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


PHP Auth::encryptPassword方法代码示例

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


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

示例1: setModelProperties

 /**
  * Populate model object properties by the passed data
  *
  * @param array $data Data to set
  *
  * @return void
  */
 protected function setModelProperties(array $data)
 {
     $adminAccessLevel = \XLite\Core\Auth::getInstance()->getAdminAccessLevel();
     if (!empty($data['password'])) {
         // Encrypt password if if is not empty
         $data['password'] = \XLite\Core\Auth::encryptPassword($data['password']);
     } elseif (isset($data['password'])) {
         // Otherwise unset password to avoid passing empty password to the database
         unset($data['password']);
     }
     // Cannot change the status of own profile
     if ($this->isLoggedProfile()) {
         unset($data['status']);
     }
     // Apply the access level only during the profile creation
     if (!$this->isRegisterMode()) {
         unset($data['access_level']);
     }
     if (isset($data['forceChangePassword']) && is_string($data['forceChangePassword'])) {
         $data['forceChangePassword'] = (bool) $data['forceChangePassword'];
     }
     $isRoot = \XLite\Core\Auth::getInstance()->isPermissionAllowed(\XLite\Model\Role\Permission::ROOT_ACCESS);
     if (isset($data['roles']) && (!$isRoot || isset($data['access_level']) && $adminAccessLevel != $data['access_level'])) {
         unset($data['roles']);
     }
     $model = $this->getModelObject();
     // Assign only role for admin
     $isAdmin = isset($data['access_level']) && $adminAccessLevel == $data['access_level'] || $model->getProfileId() && $model->isAdmin();
     if ($isAdmin && $this->needSetRootAccess($this->getModelObject())) {
         $rootRole = \XLite\Core\Database::getRepo('XLite\\Model\\Role')->findOneRoot();
         if ($rootRole) {
             if (!isset($data['roles'])) {
                 $data['roles'] = array();
             }
             $data['roles'][] = $rootRole->getId();
         }
     }
     if (isset($data['roles']) || isset($data['access_level']) && $adminAccessLevel != $data['access_level'] || $model->getProfileId() && !$model->isAdmin()) {
         // Remove old links
         foreach ($model->getRoles() as $role) {
             $role->getProfiles()->removeElement($model);
         }
         $model->getRoles()->clear();
     }
     // Add new links
     if (isset($data['roles']) && is_array($data['roles'])) {
         $data['roles'] = array_unique($data['roles']);
         foreach ($data['roles'] as $rid) {
             $role = \XLite\Core\Database::getRepo('XLite\\Model\\Role')->find($rid);
             if ($role) {
                 $model->addRoles($role);
                 $role->addProfiles($model);
             }
         }
     }
     if (isset($data['roles'])) {
         unset($data['roles']);
     }
     parent::setModelProperties($data);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:67,代码来源:AdminMainAbstract.php

示例2: generatePasswordResetKey

 /**
  * Generates password reset key
  *
  * @return string
  */
 protected function generatePasswordResetKey()
 {
     $result = \XLite\Core\Auth::encryptPassword(microtime(), \XLite\Core\Auth::DEFAULT_HASH_ALGO);
     if (!empty($result) && 0 === strpos($result, \XLite\Core\Auth::DEFAULT_HASH_ALGO)) {
         $result = substr($result, 7);
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:RecoverPassword.php

示例3: processCartProfile

 /**
  * Process cart profile
  *
  * @param boolean $doCloneProfile Clone profile flag
  *
  * @return boolean
  */
 protected function processCartProfile($doCloneProfile)
 {
     $isAnonymous = $this->isAnonymous();
     if ($isAnonymous) {
         if (\XLite\Core\Session::getInstance()->order_create_profile) {
             // Create profile based on anonymous order profile
             $this->saveAnonymousProfile();
             $this->loginAnonymousProfile();
             $this->getCart()->getOrigProfile()->setPassword(\XLite\Core\Auth::encryptPassword(\XLite\Core\Session::getInstance()->createProfilePassword));
             $isAnonymous = false;
         } elseif ($doCloneProfile) {
             $this->mergeAnonymousProfile();
         }
     } elseif ($doCloneProfile) {
         // Clone profile
         $this->cloneProfile();
         $isAnonymous = false;
     }
     return $isAnonymous;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:27,代码来源:CheckoutAbstract.php

示例4: setModelProperties

 /**
  * Populate model object properties by the passed data
  *
  * @param array $data Data to set
  *
  * @return void
  */
 protected function setModelProperties(array $data)
 {
     if (!empty($data['password'])) {
         $data['password'] = \XLite\Core\Auth::encryptPassword($data['password']);
     } elseif (isset($data['password'])) {
         unset($data['password']);
     }
     parent::setModelProperties($data);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:Main.php

示例5: doActionRegisterAsNew

 /**
  * Register anonymous profile
  * 
  * @return void
  */
 protected function doActionRegisterAsNew()
 {
     $result = false;
     $profile = $this->getModelForm()->getModelObject();
     if ($profile && $profile->isPersistent() && $profile->getAnonymous() && !$profile->getOrder() && !\XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findUserWithSameLogin($profile)) {
         $profile->setAnonymous(false);
         $password = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->generatePassword();
         $profile->setPassword(\XLite\Core\Auth::encryptPassword($password));
         $result = $profile->update();
     }
     if ($result) {
         // Send notification to the user
         \XLite\Core\Mailer::sendRegisterAnonymousCustomer($profile, $password);
         \XLite\Core\TopMessage::addInfo('The profile has been registered. The password has been sent to the user\'s email address');
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:21,代码来源:Profile.php

示例6: importPasswordColumn

 /**
  * Import password
  *
  * @param \XLite\Model\Profile $model Profile
  * @param string               $value Value
  * @param integer              $index Index
  *
  * @return void
  */
 protected function importPasswordColumn(\XLite\Model\Profile $model, $value, $index)
 {
     if (!empty($value)) {
         $model->setPassword(\XLite\Core\Auth::encryptPassword($value));
         // Schedule to delete files after import finished
         $this->importer->getOptions()->clearImportDir = true;
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:Customers.php


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