/** * Remove profileId from URL params if it is profileId of already logged in user * * @param integer $profileId Profile ID * * @return integer */ protected function correctProfileIdForURLParams($profileId) { if (\XLite\Core\Auth::getInstance()->getProfile()->getProfileId() === $profileId) { $profileId = null; } return $profileId; }
/** * Argument convertion: <LC> --> <DRUPAL> * * @param string $path Drupal path * @param array $args LC URL arguments OPTIONAL * * @return array */ public static function getPortalDrupalArgs($path, array $args = array()) { $id = empty($args['profile_id']) ? \XLite\Core\Auth::getInstance()->getProfile()->getProfileId() : $args['profile_id']; unset($args['profile_id']); list($path, $args) = parent::getPortalDrupalArgs($path, $args); $path = preg_replace('/\\%/', static::getDrupalProfileId($id), $path, 1); return array($path, $args); }
/** * Get user types * * @return array */ protected function getUserTypes() { $types = array('C' => static::t('Registered Customers'), 'N' => static::t('Anonymous Customers')); if (\XLite\Core\Auth::getInstance()->isPermissionAllowed('manage admins')) { $types['A'] = static::t('Administrator'); } return $types; }
/** * Logs in user to cart * * @param string $login User's login * @param string $password User's password * @param string $secureHash Secret token OPTIONAL * * @return \XLite\Model\Profile|integer */ public function login($login, $password, $secureHash = null) { $profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findOneBy(array('login' => $login, 'order' => null)); if ($profile && $profile->isSocialProfile()) { $result = static::RESULT_ACCESS_DENIED; } return isset($result) ? $result : parent::login($login, $password, $secureHash); }
/** * Define widget parameters * * @return void */ protected function defineWidgetParams() { parent::defineWidgetParams(); $this->widgetParams[static::PARAM_LIST]->setValue('content'); $this->widgetParams[static::PARAM_CLASS]->setValue('hl'); $this->widgetParams[static::PARAM_TITLE]->setValue(static::t('Content')); $this->widgetParams[static::PARAM_TARGET]->setValue(\XLite\Core\Auth::getInstance()->isPermissionAllowed('manage custom pages') ? 'pages' : 'menus'); }
/** * Fire event * * @return void */ protected function fireEvent() { \XLite\Core\Event::switchStorefront(array('opened' => !\XLite\Core\Auth::getInstance()->isClosedStorefront(), 'link' => $this->buildURL('storefront', '', array('action' => \XLite\Core\Auth::getInstance()->isClosedStorefront() ? 'open' : 'close')), 'privatelink' => $this->getAccessibleShopURL(false))); if ($this->isAJAX()) { $this->silent = true; $this->setSuppressOutput(true); } }
/** * Check field value validity * * @return boolean */ protected function checkFieldValue() { $isAllowedForCurrentUser = TRUE; if (!\XLite\Core\Auth::getInstance()->isPermissionAllowed('manage admins') && $this->getValue() == \XLite\Core\Auth::getInstance()->getAdminAccessLevel()) { $isAllowedForCurrentUser = FALSE; } return $isAllowedForCurrentUser && in_array($this->getValue(), \XLite\Core\Auth::getInstance()->getAccessLevelsList()); }
/** * Do action * * @return void */ protected function doActionConfirmWithPassword() { $password = \XLite\Core\Request::getInstance()->password; $result = null !== $password && \XLite\Core\Auth::comparePassword(\XLite\Core\Auth::getInstance()->getProfile()->getPassword(), $password); if (!$result) { \XLite\Core\TopMessage::addError('Incorrect password. Please try again.'); } \XLite\Core\Event::passwordConfirmed(array('result' => $result)); }
/** * Method to access a singleton * * @param boolean $doCalculate Flag for cart recalculation OPTIONAL * * @return \XLite\Model\Cart */ public static function getInstance($doCalculate = true) { $className = get_called_class(); // Create new instance of the object (if it is not already created) if (!isset(static::$instances[$className])) { $auth = \XLite\Core\Auth::getInstance(); if ($auth->isLogged()) { // Try to find cart of logged in user $cart = \XLite\Core\Database::getRepo('XLite\\Model\\Cart')->findOneByProfile($auth->getProfile()); } if (empty($cart)) { // Try to get cart from session $orderId = \XLite\Core\Session::getInstance()->order_id; if ($orderId) { $cart = \XLite\Core\Database::getRepo('XLite\\Model\\Cart')->findOneForCustomer($orderId); // Forget cart if cart is order if ($cart && !$cart->hasCartStatus()) { unset(\XLite\Core\Session::getInstance()->order_id, $cart); } } } if (!isset($cart)) { // Cart not found - create a new instance $cart = new $className(); $cart->initializeCart(); } static::$instances[$className] = $cart; if ($auth->isLogged() && (!$cart->getProfile() || $auth->getProfile()->getProfileId() != $cart->getProfile()->getProfileId())) { $cart->setProfile($auth->getProfile()); $cart->setOrigProfile($auth->getProfile()); } // Check login state if (\XLite\Core\Session::getInstance()->lastLoginUnique === null && $cart->getProfile() && $cart->getProfile()->getAnonymous() && $cart->getProfile()->getLogin()) { $tmpProfile = new \XLite\Model\Profile(); $tmpProfile->setProfileId(0); $tmpProfile->setLogin($cart->getProfile()->getLogin()); $profile2 = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findUserWithSameLogin($tmpProfile); if ($profile2) { \XLite\Core\Database::getEM()->detach($profile2); } \XLite\Core\Session::getInstance()->lastLoginUnique = !$profile2; } if (!$doCalculate) { $cart->setIgnoreLongCalculations(); } if (!$cart->isIgnoreLongCalculations() && ($cart instanceof \XLite\Model\Cart || \XLite\Core\Converter::time() - static::RENEW_PERIOD > $cart->getLastRenewDate())) { $cart->renew(); } else { $cart->calculate(); } $cart->renewSoft(); \XLite\Core\Session::getInstance()->order_id = $cart->getOrderId(); } return static::$instances[$className]; }
/** * Do action * * @return void */ protected function doActionConfirmWithPassword() { $password = \XLite\Core\Request::getInstance()->password; $result = null !== $password && \XLite\Core\Auth::comparePassword(\XLite\Core\Auth::getInstance()->getProfile()->getPassword(), $password); if ($result) { echo 1; } else { \XLite\Core\TopMessage::addError('Incorrect password. Please try again.'); echo 0; } }
/** * Return URL to redirect to * * @return string */ protected function getAdminAreaURLArgs() { $query = ''; if (\XLite\Core\Auth::getInstance()->isAdmin()) { $query .= '?' . \XLite\Core\Session::getInstance()->getName(); $query .= '=' . \XLite\Core\Session::getInstance()->getId(); $query .= '&' . static::PARAM_DRUPAL_RETURN_URL; $query .= '=' . urlencode(\Includes\Utils\URLManager::getCurrentURL()); } return $query; }
/** * Define menu items * * @return array */ protected function defineItems() { $menu = array(); $cnd = new \XLite\Core\CommonCell(); $cnd->type = \XLite\Module\CDev\SimpleCMS\Model\Menu::MENU_TYPE_FOOTER; $cnd->enabled = true; $cnd->visibleFor = array('AL', \XLite\Core\Auth::getInstance()->isLogged() ? 'L' : 'A'); foreach (\XLite\Core\Database::getRepo('XLite\\Module\\CDev\\SimpleCMS\\Model\\Menu')->search($cnd) as $v) { $menu[] = array('url' => $v->getURL(), 'label' => $v->getName(), 'controller' => $v->getLinkController()); } return $menu ?: parent::defineItems(); }
/** * Get stored profiel id * * @return integer */ protected function getStoredProfileId() { $profileId = parent::getStoredProfileId(); if (!$profileId && \XLite\Module\CDev\DrupalConnector\Handler::getInstance()->checkCurrentCMS() && !empty($GLOBALS['user']) && !empty($GLOBALS['user']->uid)) { $profileId = \XLite\Module\CDev\DrupalConnector\Handler::getInstance()->getProfileIdByCMSId($GLOBALS['user']->uid); if ($profileId) { // Save profile Id in session \XLite\Core\Session::getInstance()->profile_id = $profileId; } } return $profileId; }
/** * Define menu items * * @return array */ protected function defineItems() { $menu = array(); $cnd = new \XLite\Core\CommonCell(); $cnd->type = \XLite\Module\CDev\SimpleCMS\Model\Menu::MENU_TYPE_PRIMARY; $cnd->enabled = true; $cnd->visibleFor = array('AL', \XLite\Core\Auth::getInstance()->isLogged() ? 'L' : 'A'); foreach (\XLite\Core\Database::getRepo('XLite\\Module\\CDev\\SimpleCMS\\Model\\Menu')->search($cnd) as $v) { $menu[] = $this->defineItem($v); } return \XLite\Core\Config::getInstance()->CDev->SimpleCMS->show_default_menu ? array_merge(parent::defineItems(), $menu) : ($menu ?: parent::defineItems()); }
/** * getProfile * * @return \XLite\Model\Profile */ public function getProfile() { if (!isset($this->profile)) { $profileId = \XLite\Core\Request::getInstance()->profile_id; if (isset($profileId)) { $this->profile = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->find($profileId); } else { $this->profile = \XLite\Core\Auth::getInstance()->getProfile(); } } return $this->profile; }
/** * Define menu items * * @return array */ protected function defineItems() { $menu = array(); $menu[] = array('target' => \XLite::TARGET_DEFAULT, 'url' => $this->buildURL(''), 'label' => static::t('Home')); $menu[] = array('target' => 'cart', 'url' => $this->buildURL('cart'), 'label' => static::t('Shopping bag')); if (\XLite\Core\Auth::getInstance()->isLogged()) { $menu[] = array('target' => 'profile', 'url' => $this->buildURL('profile'), 'label' => static::t('My account')); } else { $menu[] = array('target' => 'profile', 'url' => $this->buildURL('profile', '', array('mode' => 'register')), 'label' => static::t('Register')); } return $menu; }
/** * Override constructor to add new tab * * @param array $params Handler params OPTIONAL * * @return void */ public function __construct(array $params = array()) { if ($this->isLogged()) { $cnd = new \XLite\Core\CommonCell(); $cnd->user = \XLite\Core\Auth::getInstance()->getProfile(); $count = \XLite\Core\Database::getRepo('XLite\\Model\\Order')->searchWithPinCodes($cnd, true); if ($count > 0) { $this->tabs['pin_codes'] = array('title' => 'PIN codes', 'template' => 'modules/CDev/PINCodes/account_pin_codes.tpl'); } } parent::__construct($params); }
/** * Register event to the order * * @param integer $orderId Order identificator * @param string $code Event code * @param string $description Event description * @param array $data Data for event description OPTIONAL * @param string $comment Event comment OPTIONAL * @param array $details Event details OPTIONAL * * @return void */ public function registerEvent($orderId, $code, $description, array $data = array(), $comment = '', $details = array()) { $event = new \XLite\Model\OrderHistoryEvents(array('date' => time(), 'code' => $code, 'description' => $description, 'data' => $data, 'comment' => $comment)); if (!empty($details)) { $event->setDetails($details); } $order = \XLite\Core\Database::getRepo('XLite\\Model\\Order')->find($orderId); if (\XLite\Core\Auth::getInstance()->getProfile()) { $event->setAuthor(\XLite\Core\Auth::getInstance()->getProfile()); } $event->setOrder($order); $order->addEvents($event); $this->insert($event); }
/** * Return value of data * * @param string $field Field * * @return string */ public function getValue($field) { $data = \XLite\Core\Session::getInstance()->contact_us; $value = $data && isset($data[$field]) ? $data[$field] : ''; if (!$value && in_array($field, array('name', 'email'))) { $auth = \XLite\Core\Auth::getInstance(); if ($auth->isLogged()) { if ('email' == $field) { $value = $auth->getProfile()->getLogin(); } elseif (0 < $auth->getProfile()->getAddresses()->count()) { $value = $auth->getProfile()->getAddresses()->first()->getName(); } } } return $value; }
/** * Perform login action * * @return void */ protected function doActionLogin() { $loginApi = new \XLite\Module\CDev\Paypal\Core\Login(); $requestProcessed = false; $returnURL = ''; \XLite\Module\CDev\Paypal\Main::addLog('Login return', \XLite\Core\Request::getInstance()->getData()); if ($loginApi->checkRequest()) { $accessToken = $loginApi->createFromAuthorisationCode(\XLite\Core\Request::getInstance()->code); $profileInfo = isset($accessToken['access_token']) ? $loginApi->getUserinfo($accessToken['access_token']) : null; if ($profileInfo && !empty($profileInfo['user_id']) && !empty($profileInfo['email'])) { $profile = $this->getSocialLoginProfile($profileInfo['email'], 'PayPal', $profileInfo['user_id'], $profileInfo); if ($profile) { if ($profile->isEnabled()) { \XLite\Core\Auth::getInstance()->loginProfile($profile); $accessToken['expirationTime'] = LC_START_TIME + $accessToken['expires_in']; \XLite\Core\Session::getInstance()->paypalAccessToken = $accessToken; // We merge the logged in cart into the session cart $profileCart = $this->getCart(); $profileCart->login($profile); \XLite\Core\Database::getEM()->flush(); if ($profileCart->isPersistent()) { $this->updateCart(); } $returnURL = $this->getAuthReturnURL(); } else { \XLite\Core\TopMessage::addError('Profile is disabled'); $returnURL = $this->getAuthReturnURL(true); } } else { $provider = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findOneBy(array('login' => $profileInfo['email'], 'order' => null))->getSocialLoginProvider(); if ($provider) { $signInVia = 'Please sign in with ' . $provider . '.'; } else { $signInVia = 'Profile with the same e-mail address already registered. ' . 'Please sign in the classic way.'; } \XLite\Core\TopMessage::addError($signInVia); $returnURL = $this->getAuthReturnURL(true); } $requestProcessed = true; } } if (!$requestProcessed) { \XLite\Core\TopMessage::addError('We were unable to process this request'); $returnURL = ''; } $this->closePopup($returnURL); }
/** * Check ACL permissions * * @return boolean */ public function checkACL() { $result = parent::checkACL(); if (!$result) { $dictionary = \XLite\Core\Request::getInstance()->dictionary; $permissions = $this->getDictionaryPermissions(); if (!empty($permissions[$dictionary])) { foreach ($permissions[$dictionary] as $p) { if (\XLite\Core\Auth::getInstance()->isPermissionAllowed($p)) { $result = true; break; } } } } return $result; }
/** * Get return URL * * @return string */ public function getReturnURL() { if (\XLite\Core\Request::getInstance()->action) { $profileId = \XLite\Core\Request::getInstance()->profile_id; if (!isset($profileId)) { $profileId = $this->getAddress()->getProfile()->getProfileId(); if (\XLite\Core\Auth::getInstance()->getProfile()->getProfileId() === $profileId) { unset($profileId); } } $params = isset($profileId) ? array('profile_id' => $profileId) : array(); $url = $this->buildURL('address_book', '', $params); } else { $url = parent::getReturnURL(); } return $url; }
protected function getTestOrder($new_order = false) { xdebug_stop_code_coverage(false); if ($this->order && !$new_order) { return $this->order; } \XLite\Core\Auth::getInstance()->logoff(); $this->testOrder['date'] = time(); $order = \XLite\Core\Database::getRepo('XLite\\Model\\Order')->insert($this->testOrder); $order->setCurrency(\XLite\Core\Database::getRepo('XLite\\Model\\Currency')->find(840)); if ($this->orderProducts) { foreach ($this->orderProducts as $sku) { $product = $this->getProductBySku($sku); $this->assertNotNull($product, 'Product with SKU ' . $sku . ' not found!'); $item = new \XLite\Model\OrderItem(); $item->setProduct($product); $item->setAmount(1); $order->addItem($item); } } else { $item = new \XLite\Model\OrderItem(); $item->setProduct($this->getProduct()); $item->setAmount(1); $order->addItem($item); } $list = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findAll(); $found = false; foreach ($list as $p) { if (!$p->getOrder() && $p->getLogin() == '*****@*****.**') { $order->setProfileCopy($p); $found = true; break; } } $this->assertTrue($found, 'test order\'s profile is not found'); $order->calculate(); \XLite\Core\Database::getRepo('XLite\\Model\\Order')->update($order); if (!$this->order || $new_order) { $this->orders[] = $order; } $this->order = $order; xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); return $order; }
/** * Send Moneybookers activation message * * @return void */ public static function sendMoneybookersActivation() { // Register variables static::register('platform_name', \XLite\Module\CDev\Moneybookers\Model\Payment\Processor\Moneybookers::getPlatformName()); $address = \XLite\Core\Auth::getInstance()->getProfile()->getBillingAddress(); if ($address) { static::register('first_name', $address->getFirstName()); static::register('last_name', $address->getLastName()); } else { static::register('first_name', ''); static::register('last_name', ''); } static::register('email', \XLite\Core\Config::getInstance()->CDev->Moneybookers->email); static::register('id', \XLite\Core\Config::getInstance()->CDev->Moneybookers->id); static::register('url', \XLite::getInstance()->getShopURL()); static::register('language', \XLite\Core\Session::getInstance()->getLanguage()->getCode()); // Compose and send email static::compose(\XLite\Core\Config::getInstance()->Company->site_administrator, '*****@*****.**', 'modules/CDev/Moneybookers/activation'); }
/** * getDefaultFieldValue * * @param string $name Field name * * @return mixed */ public function getDefaultFieldValue($name) { $value = parent::getDefaultFieldValue($name); switch ($name) { case 'access_level': if (\XLite\Core\Auth::getInstance()->getCustomerAccessLevel() == $value) { $value = static::t('Customer'); } elseif (\XLite\Core\Auth::getInstance()->getAdminAccessLevel() == $value) { $value = static::t('Administrator'); } else { $value = static::t('Unknown'); } break; case 'status': $value = 'E' === $value ? static::t('Enabled') : static::t('Disabled'); break; default: } return $value; }
/** * Send Moneybookers activation message * * @return void */ public static function sendMoneybookersActivation() { // Register variables static::register('platform_name', \XLite\Module\CDev\Moneybookers\Model\Payment\Processor\Moneybookers::getPlatformName()); $address = \XLite\Core\Auth::getInstance()->getProfile()->getBillingAddress(); if ($address) { static::register('first_name', $address->getFirstName()); static::register('last_name', $address->getLastName()); } else { static::register('first_name', ''); static::register('last_name', ''); } static::register('email', \XLite\Core\Config::getInstance()->CDev->Moneybookers->email); static::register('id', \XLite\Core\Config::getInstance()->CDev->Moneybookers->id); static::register('url', \XLite::getInstance()->getShopURL()); static::register('language', \XLite\Core\Session::getInstance()->getLanguage()->getCode()); static::getMailer()->setSubjectTemplate('modules/CDev/Moneybookers/activation/subject.tpl'); static::getMailer()->setLayoutTemplate('modules/CDev/Moneybookers/activation/body.tpl'); // Compose and send email static::compose(static::TYPE_MONEYBOOKERS_ACTIVATION, static::getSiteAdministratorMail(), '*****@*****.**', 'modules/CDev/Moneybookers/activation'); }
/** * Method to access a singleton * * @return \XLite\Model\Cart */ public static function getInstance() { $className = get_called_class(); // Create new instance of the object (if it is not already created) if (!isset(static::$instances[$className])) { $orderId = \XLite\Core\Session::getInstance()->order_id; if ($orderId) { $cart = \XLite\Core\Database::getRepo('XLite\\Model\\Cart')->find($orderId); if ($cart && !$cart->hasCartStatus()) { \XLite\Core\Session::getInstance()->order_id = 0; $cart = null; } } if (!isset($cart)) { $cart = new $className(); $cart->initializeCart(); \XLite\Core\Database::getEM()->persist($cart); } static::$instances[$className] = $cart; $auth = \XLite\Core\Auth::getInstance(); if ($auth->isLogged()) { if (!$cart->getProfile() || $auth->getProfile()->getProfileId() != $cart->getProfile()->getProfileId()) { $cart->setProfile($auth->getProfile()); $cart->setOrigProfile($auth->getProfile()); $cart->calculate(); } } elseif ($cart->getProfile() && $cart->getProfile()->getProfileId()) { $cart->setProfile(null); $cart->calculate(); } \XLite\Core\Database::getEM()->flush(); if (\XLite\Model\Order::STATUS_TEMPORARY == $cart->getStatus() || time() - static::RENEW_PERIOD > $cart->getLastRenewDate()) { $cart->renew(); } $cart->renewSoft(); \XLite\Core\Session::getInstance()->order_id = $cart->getOrderId(); } return static::$instances[$className]; }
/** * Perform login action * * @return void */ protected function doActionLogin() { $authProviders = \XLite\Module\CDev\SocialLogin\Core\AuthManager::getAuthProviders(); $requestProcessed = false; foreach ($authProviders as $authProvider) { if ($authProvider->detectAuth()) { $profileInfo = $authProvider->processAuth(); if ($profileInfo && !empty($profileInfo['id']) && !empty($profileInfo['email'])) { $profile = $this->getSocialLoginProfile($profileInfo['email'], $authProvider->getName(), $profileInfo['id']); if ($profile) { if ($profile->isEnabled()) { \XLite\Core\Auth::getInstance()->loginProfile($profile); $this->setAuthReturnURL($authProvider::STATE_PARAM_NAME); } else { \XLite\Core\TopMessage::addError('Profile is disabled'); $this->setAuthReturnURL($authProvider::STATE_PARAM_NAME, true); } } else { $provider = \XLite\Core\Database::getRepo('XLite\\Model\\Profile')->findOneBy(array('login' => $profileInfo['email'], 'order' => null))->getSocialLoginProvider(); if ($provider) { $signInVia = 'Please sign in with ' . $provider . '.'; } else { $signInVia = 'Profile with the same e-mail address already registered. ' . 'Please sign in the classic way.'; } \XLite\Core\TopMessage::addError($signInVia); $this->setAuthReturnURL($authProvider::STATE_PARAM_NAME, true); } $requestProcessed = true; } } } if (!$requestProcessed) { \XLite\Core\TopMessage::addError('We were unable to process this request'); $this->setAuthReturnURL('', true); } }
/** * 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); }
/** * 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; }