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


PHP Salt\SaltFactory类代码示例

本文整理汇总了PHP中TYPO3\CMS\Saltedpasswords\Salt\SaltFactory的典型用法代码示例。如果您正苦于以下问题:PHP SaltFactory类的具体用法?PHP SaltFactory怎么用?PHP SaltFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getAdminAccountStatus

 /**
  * Checks whether a an BE user account named admin with default password exists.
  *
  * @return \TYPO3\CMS\Reports\Status An object representing whether a default admin account exists
  */
 protected function getAdminAccountStatus()
 {
     $value = $GLOBALS['LANG']->getLL('status_ok');
     $message = '';
     $severity = \TYPO3\CMS\Reports\Status::OK;
     $whereClause = 'username = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users') . BackendUtility::deleteClause('be_users');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
     $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
     if (!empty($row)) {
         $secure = TRUE;
         /** @var $saltingObject \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface */
         $saltingObject = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($row['password']);
         if (is_object($saltingObject)) {
             if ($saltingObject->checkPassword('password', $row['password'])) {
                 $secure = FALSE;
             }
         }
         // Check against plain MD5
         if ($row['password'] === '5f4dcc3b5aa765d61d8327deb882cf99') {
             $secure = FALSE;
         }
         if (!$secure) {
             $value = $GLOBALS['LANG']->getLL('status_insecure');
             $severity = \TYPO3\CMS\Reports\Status::ERROR;
             $editUserAccountUrl = BackendUtility::getModuleUrl('record_edit', array('edit[be_users][' . $row['uid'] . ']' => 'edit', 'returnUrl' => BackendUtility::getModuleUrl('system_ReportsTxreportsm1')));
             $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.backend_admin'), '<a href="' . htmlspecialchars($editUserAccountUrl) . '">', '</a>');
         }
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return GeneralUtility::makeInstance(\TYPO3\CMS\Reports\Status::class, $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:36,代码来源:SecurityStatus.php

示例2: getAdminAccountStatus

 /**
  * Checks whether a an BE user account named admin with default password exists.
  *
  * @return \TYPO3\CMS\Reports\Status An tx_reports_reports_status_Status object representing whether a default admin account exists
  */
 protected function getAdminAccountStatus()
 {
     $value = $GLOBALS['LANG']->getLL('status_ok');
     $message = '';
     $severity = \TYPO3\CMS\Reports\Status::OK;
     $whereClause = 'username = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $secure = TRUE;
         // Check against salted password
         if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords')) {
             if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('BE')) {
                 /** @var $saltingObject \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface */
                 $saltingObject = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($row['password']);
                 if (is_object($saltingObject)) {
                     if ($saltingObject->checkPassword('password', $row['password'])) {
                         $secure = FALSE;
                     }
                 }
             }
         }
         // Check against plain MD5
         if ($row['password'] === '5f4dcc3b5aa765d61d8327deb882cf99') {
             $secure = FALSE;
         }
         if (!$secure) {
             $value = $GLOBALS['LANG']->getLL('status_insecure');
             $severity = \TYPO3\CMS\Reports\Status::ERROR;
             $editUserAccountUrl = 'alt_doc.php?returnUrl=mod.php?M=tools_txreportsM1&edit[be_users][' . $row['uid'] . ']=edit';
             $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_admin'), '<a href="' . $editUserAccountUrl . '">', '</a>');
         }
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity);
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:40,代码来源:SecurityStatus.php

示例3: createCliBeUser

 protected function createCliBeUser()
 {
     $db = $this->getDatabaseConnection();
     $where = 'username = ' . $db->fullQuoteStr('_cli_lowlevel', 'be_users') . ' AND admin = 0';
     $user = $db->exec_SELECTgetSingleRow('*', 'be_users', $where);
     if ($user) {
         if ($user['deleted'] || $user['disable']) {
             $data = array('be_users' => array($user['uid'] => array('deleted' => 0, 'disable' => 0)));
             /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
             $dataHandler = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
             $dataHandler->stripslashes_values = FALSE;
             $dataHandler->start($data, array());
             $dataHandler->process_datamap();
         }
     } else {
         // Prepare necessary data for _cli_lowlevel user creation
         $password = uniqid('scheduler', TRUE);
         if (SaltedPasswordsUtility::isUsageEnabled()) {
             $objInstanceSaltedPW = SaltFactory::getSaltingInstance();
             $password = $objInstanceSaltedPW->getHashedPassword($password);
         }
         $data = array('be_users' => array('NEW' => array('username' => '_cli_lowlevel', 'password' => $password, 'pid' => 0)));
         /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
         $dataHandler = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
         $dataHandler->stripslashes_values = FALSE;
         $dataHandler->start($data, array());
         $dataHandler->process_datamap();
         // Check if a new uid was indeed generated (i.e. a new record was created)
         // (counting DataHandler errors doesn't work as some failures don't report errors)
         $numberOfNewIDs = count($dataHandler->substNEWwithIDs);
         if ((int) $numberOfNewIDs !== 1) {
             InstallerScripts::addFlashMessage('Failed to create _cli_lowlevel BE user.', 'BE user creation failed', AbstractMessage::WARNING);
         }
     }
 }
开发者ID:Outdoorsman,项目名称:typo3_console,代码行数:35,代码来源:ExtensionInstallation.php

示例4: setPassword

 public function setPassword($password)
 {
     if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
         $objSalt = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(NULL);
         if (is_object($objSalt)) {
             $password = $objSalt->getHashedPassword($password);
         }
     }
     parent::setPassword($password);
 }
开发者ID:TUGNR,项目名称:ds_example,代码行数:10,代码来源:FrontendUser.php

示例5: applyTransformations

 /**
  * Applies transformations to a given plain text password, e.g. hashing
  *
  * @param string $password
  * @return string
  */
 public function applyTransformations($password)
 {
     if (ExtensionManagementUtility::isLoaded('saltedpasswords')) {
         if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
             $saltingInstance = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance();
             $password = $saltingInstance->getHashedPassword($password);
         }
     }
     return $password;
 }
开发者ID:romaincanon,项目名称:hairu,代码行数:16,代码来源:PasswordService.php

示例6: addHasher

 /**
  * Adds the password hasher object to the context
  *
  * @param \Aimeos\MShop\Context\Item\Iface $context Context object
  * @return \Aimeos\MShop\Context\Item\Iface Modified context object
  */
 protected static function addHasher(\Aimeos\MShop\Context\Item\Iface $context)
 {
     if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher']) && is_callable($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'])) {
         return $fcn($context);
     }
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords') && \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
         $object = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance();
         $context->setHasherTypo3($object);
     }
     return $context;
 }
开发者ID:aimeos,项目名称:aimeos-typo3,代码行数:17,代码来源:Context.php

示例7: hash

 /**
  * This function takes a password as argument, salts it and returns the new password.
  *
  * @param string $password
  *
  * @return string
  */
 public function hash($password)
 {
     if (ExtensionManagementUtility::isLoaded('saltedpasswords')) {
         $salter = SaltFactory::getSaltingInstance(null, 'FE');
         $password = $salter->getHashedPassword($password);
         if ($this->isValidMd5($password)) {
             $password = 'M' . $password;
         }
     }
     return $password;
 }
开发者ID:sirdiego,项目名称:importr,代码行数:18,代码来源:PasswordHashService.php

示例8: getSaltedPassword

 /**
  * @return string
  */
 protected function getSaltedPassword($password)
 {
     $saltedPassword = $password;
     if (ExtensionManagementUtility::isLoaded('saltedpasswords')) {
         if (SaltedPasswordsUtility::isUsageEnabled('FE')) {
             $objSalt = SaltFactory::getSaltingInstance(NULL);
             if (is_object($objSalt)) {
                 $saltedPassword = $objSalt->getHashedPassword($password);
             }
         }
     }
     return $saltedPassword;
 }
开发者ID:Ecodev,项目名称:formule,代码行数:16,代码来源:UserDataProcessor.php

示例9: createCLIUsers

 /**
  * Creates users based on given array.
  *
  * @param $packageKey
  * @param $configuration
  * @param $configurationController
  */
 public function createCLIUsers($packageKey, $configuration, $configurationController)
 {
     // Only create CLI users on configuration save of template bootstrap package
     if (TemplateBootstrapUtility::getPackageKey() !== $packageKey) {
         return;
     }
     // Get cli user names that supposedly need to be created
     $userNames = GeneralUtility::trimExplode(',', $configuration['createCLIUsers']['value']);
     foreach ($userNames as $userName) {
         $cliUserName = '_cli_' . $userName;
         $cliUserNameQuoted = $GLOBALS['TYPO3_DB']->fullQuoteStr($cliUserName, 'be_users');
         // Check, if user exists already
         $userExistsResult = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'be_users', 'username=' . $cliUserNameQuoted);
         if ($GLOBALS['TYPO3_DB']->sql_error()) {
             PostInstallInfoLogger::log('Failed to check whether BE user "' . $cliUserName . '" exists. Therefore cancelled. Error: ' . $GLOBALS['TYPO3_DB']->sql_error(), PostInstallInfoLogger::MESSAGE_TYPE_SYSTEM_ERROR);
             continue;
         }
         // User exists - (re-) activate, in case it has been deleted previously
         if ($GLOBALS['TYPO3_DB']->sql_num_rows($userExistsResult) > 0) {
             $existingUserRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($userExistsResult);
             if ($existingUserRow['deleted']) {
                 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users', 'uid=' . $existingUserRow['uid'], array('deleted' => 0));
                 $updatedError = $GLOBALS['TYPO3_DB']->sql_error();
                 if ($updatedError) {
                     PostInstallInfoLogger::log('Failed to reactivate (un-delete) BE user "' . $cliUserName . '". Error: ' . $GLOBALS['TYPO3_DB']->sql_error(), PostInstallInfoLogger::MESSAGE_TYPE_SYSTEM_ERROR);
                 } else {
                     PostInstallInfoLogger::log('Reactivated (un-deleted) BE user "' . $cliUserName . '"' . $GLOBALS['TYPO3_DB']->sql_error(), PostInstallInfoLogger::MESSAGE_TYPE_OK);
                 }
             }
             // Skip to next user(name) as this one was handled by simply reactivating it.
             continue;
         }
         // Create user
         $saltedPassword = md5($this->getRandomPassword());
         if (PackageManager::isPackageActive('saltedpasswords')) {
             $saltingInstance = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance();
             $saltedPassword = $saltingInstance->getHashedPassword($saltedPassword);
         }
         $createdSqlResult = $GLOBALS['TYPO3_DB']->exec_INSERTquery('be_users', array('crdate' => time(), 'tstamp' => time(), 'cruser_id' => $GLOBALS['BE_USER']->user['uid'], 'username' => $cliUserName, 'password' => $saltedPassword));
         // Failed to create user
         if ($GLOBALS['TYPO3_DB']->sql_error()) {
             PostInstallInfoLogger::log('Failed to create BE user "' . $cliUserName . '". Error: ' . $GLOBALS['TYPO3_DB']->sql_error(), PostInstallInfoLogger::MESSAGE_TYPE_SYSTEM_ERROR);
             // User successfully created
         } else {
             PostInstallInfoLogger::log('Created BE user "' . $cliUserName . '"', PostInstallInfoLogger::MESSAGE_TYPE_OK);
         }
     }
     // foreach user that needs to be created
 }
开发者ID:martinpfister,项目名称:manuel,代码行数:56,代码来源:PostInstallDatabaseHandler.php

示例10: evaluateFieldValue

 /**
  * Function uses Portable PHP Hashing Framework to create a proper password string if needed
  *
  * @param mixed $value The value that has to be checked.
  * @param string $is_in Is-In String
  * @param integer $set Determines if the field can be set (value correct) or not, e.g. if input is required but the value is empty, then $set should be set to FALSE. (PASSED BY REFERENCE!)
  * @return The new value of the field
  * @todo Define visibility
  */
 public function evaluateFieldValue($value, $is_in, &$set)
 {
     $isEnabled = $this->mode ? \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled($this->mode) : \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled();
     if ($isEnabled) {
         $set = FALSE;
         $isMD5 = preg_match('/[0-9abcdef]{32,32}/', $value);
         $isSaltedHash = \TYPO3\CMS\Core\Utility\GeneralUtility::inList('$1$,$2$,$2a,$P$', substr($value, 0, 3));
         $this->objInstanceSaltedPW = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(NULL, $this->mode);
         if ($isMD5) {
             $set = TRUE;
             $value = 'M' . $this->objInstanceSaltedPW->getHashedPassword($value);
         } elseif (!$isSaltedHash) {
             $set = TRUE;
             $value = $this->objInstanceSaltedPW->getHashedPassword($value);
         }
     }
     return $value;
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:27,代码来源:Evaluator.php

示例11: getInstallToolPasswordStatus

 /**
  * Checks whether the Install Tool password is set to its default value.
  *
  * @return Status An object representing the security of the install tool password
  */
 protected function getInstallToolPasswordStatus()
 {
     $value = $GLOBALS['LANG']->getLL('status_ok');
     $message = '';
     $severity = Status::OK;
     $validPassword = true;
     $installToolPassword = $GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'];
     $saltFactory = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($installToolPassword);
     if (is_object($saltFactory)) {
         $validPassword = !$saltFactory->checkPassword('joh316', $installToolPassword);
     } elseif ($installToolPassword === md5('joh316')) {
         $validPassword = false;
     }
     if (!$validPassword) {
         $value = $GLOBALS['LANG']->getLL('status_insecure');
         $severity = Status::ERROR;
         $changeInstallToolPasswordUrl = BackendUtility::getModuleUrl('system_InstallInstall');
         $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.installtool_default_password'), '<a href="' . htmlspecialchars($changeInstallToolPasswordUrl) . '">', '</a>');
     }
     return GeneralUtility::makeInstance(Status::class, $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_installToolPassword'), $value, $message, $severity);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:26,代码来源:SecurityStatusReport.php

示例12: evaluateFieldValue

 /**
  * Function uses Portable PHP Hashing Framework to create a proper password string if needed
  *
  * @param mixed $value The value that has to be checked.
  * @param string $is_in Is-In String
  * @param bool $set Determines if the field can be set (value correct) or not, e.g. if input is required but the value is empty, then $set should be set to FALSE. (PASSED BY REFERENCE!)
  * @return string The new value of the field
  */
 public function evaluateFieldValue($value, $is_in, &$set)
 {
     $isEnabled = $this->mode ? \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled($this->mode) : \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled();
     if ($isEnabled) {
         $isMD5 = preg_match('/[0-9abcdef]{32,32}/', $value);
         $isDeprecatedSaltedHash = \TYPO3\CMS\Core\Utility\GeneralUtility::inList('C$,M$', substr($value, 0, 2));
         /** @var $objInstanceSaltedPW \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface */
         $objInstanceSaltedPW = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(NULL, $this->mode);
         if ($isMD5) {
             $set = TRUE;
             $value = 'M' . $objInstanceSaltedPW->getHashedPassword($value);
         } else {
             // Determine method used for the (possibly) salted hashed password
             $tempValue = $isDeprecatedSaltedHash ? substr($value, 1) : $value;
             $tempObjInstanceSaltedPW = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($tempValue);
             if (!is_object($tempObjInstanceSaltedPW)) {
                 $set = TRUE;
                 $value = $objInstanceSaltedPW->getHashedPassword($value);
             }
         }
     }
     return $value;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:31,代码来源:Evaluator.php

示例13: resettingFactoryInstanceSucceeds

 /**
  * @test
  */
 public function resettingFactoryInstanceSucceeds()
 {
     $defaultClassNameToUse = \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::getDefaultSaltingHashingMethod();
     if ($defaultClassNameToUse == 'TYPO3\\CMS\\Saltedpasswords\\Salt\\Md5Salt') {
         $saltedPW = '$P$CWF13LlG/0UcAQFUjnnS4LOqyRW43c.';
     } else {
         $saltedPW = '$1$rasmusle$rISCgZzpwk3UhDidwXvin0';
     }
     $this->objectInstance = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($saltedPW);
     // resetting
     $this->objectInstance = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(NULL);
     $this->assertTrue(get_class($this->objectInstance) == $defaultClassNameToUse || is_subclass_of($this->objectInstance, $defaultClassNameToUse));
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:16,代码来源:SaltFactoryTest.php

示例14: getContext

 /**
  * Returns the current context.
  *
  * @param \Aimeos\MW\Config\Iface Configuration object
  * @return MShop_Context_Item_Interface Context object
  */
 public static function getContext(\Aimeos\MW\Config\Iface $config)
 {
     if (self::$context === null) {
         $context = new \Aimeos\MShop\Context\Item\Typo3();
         $context->setConfig($config);
         $dbm = new \Aimeos\MW\DB\Manager\PDO($config);
         $context->setDatabaseManager($dbm);
         $fsm = new \Aimeos\MW\Filesystem\Manager\Standard($config);
         $context->setFilesystemManager($fsm);
         $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context);
         $context->setLogger($logger);
         $cache = self::getCache($context);
         $context->setCache($cache);
         $mailer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
         $context->setMail(new \Aimeos\MW\Mail\Typo3($mailer));
         if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords') && \TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('FE')) {
             $object = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance();
             $context->setHasherTypo3($object);
         }
         if (isset($GLOBALS['TSFE']->fe_user)) {
             $session = new \Aimeos\MW\Session\Typo3($GLOBALS['TSFE']->fe_user);
         } else {
             $session = new \Aimeos\MW\Session\None();
         }
         $context->setSession($session);
         self::$context = $context;
     }
     self::$context->setConfig($config);
     return self::$context;
 }
开发者ID:Niko-r,项目名称:aimeos-typo3,代码行数:36,代码来源:Base.php

示例15: createFrontendUserRecordFromSocialUser

 /**
  * Creates a frontend user based on the data of the social user
  *
  * @param \Hybrid_User_Profile $socialUser
  * @param int $pid
  *
  * @return array|bool|null the created user record or false if it is not possible
  * @throws \Exception
  */
 protected function createFrontendUserRecordFromSocialUser($socialUser, $pid)
 {
     $result = false;
     if (isset($socialUser->email) || isset($socialUser->emailVerified)) {
         // we should load the TCA explicitly, because we are in authentication step and TCA could be not loaded yet
         if (!isset($GLOBALS['TCA']['fe_users'])) {
             Bootstrap::getInstance()->loadCachedTca();
         }
         /** @var \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler */
         $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
         $email = $socialUser->email ? $socialUser->email : $socialUser->emailVerified;
         if (ExtensionManagementUtility::isLoaded('saltedpasswords')) {
             /** @var \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface $saltedpasswordsInstance */
             $saltedpasswordsInstance = SaltFactory::getSaltingInstance();
             $password = $saltedpasswordsInstance->getHashedPassword(uniqid());
         } else {
             $password = md5(uniqid());
         }
         $where = 'uid = 1 AND hidden = 0 AND deleted = 0';
         $fe_group = $this->database->exec_SELECTgetSingleRow('*', 'fe_groups', $where);
         if ($fe_group === false) {
             throw new \Exception('[px_hybrid_auth]: No fe_group found for uid: 1. Please create a fe_groups record, which will be set as default frontend usergroup during social login.', 1445939594);
         }
         $insertArray = ['pid' => $pid, 'username' => $email, 'password' => $password, 'usergroup' => 1, 'email' => $email, 'first_name' => $socialUser->firstName, 'last_name' => $socialUser->lastName, 'disable' => 0, 'deleted' => 0, 'tstamp' => time(), 'crdate' => time()];
         // extend the insert array with fields from PxHybridAuth_Hybrid_User_Profile
         if ($socialUser instanceof \PxHybridAuth_Hybrid_User_Profile) {
             if ($socialUser->company) {
                 $insertArray['company'] = $socialUser->company;
             }
         }
         $this->database->exec_INSERTquery('fe_users', $insertArray);
         $id = $this->database->sql_insert_id();
         $username = $dataHandler->getUnique('fe_users', 'username', $email, $id);
         if ($username != $email) {
             $this->database->exec_UPDATEquery('fe_users', 'uid=' . intval($id), ['username' => $username]);
         }
         $where = 'uid=' . intval($id);
         $result = $this->database->exec_SELECTgetSingleRow('*', 'fe_users', $where);
     }
     return $result;
 }
开发者ID:portrino,项目名称:px_hybrid_auth,代码行数:50,代码来源:SocialLoginAuthenticationServiceSlot.php


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