Commit fdb4fdd0 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Revert "Merge branch '165-uri-builder-fails-at-reactivate-user-process' into 'develop'"

This reverts merge request !85
parent a34b3630
Pipeline #5025 passed with stages
in 4 minutes and 38 seconds
<?php
declare(strict_types = 1);
namespace T3o\T3omy\Domain\Repository;
use TYPO3\CMS\Extbase\Persistence\Repository;
......@@ -12,13 +11,4 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
*/
class OldUserRepository extends Repository
{
public function __construct()
{
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
parent::__construct($objectManager);
$querySettings = $objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}
}
......@@ -39,37 +39,27 @@ class ReactivateUserHook
/**
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
*/
public function reactivateOldUser(array $params, \TYPO3\CMS\Felogin\Controller\FrontendLoginController $frontendLoginController)
public function reactivateOldUser()
{
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
$this->oldUserRepository = $this->objectManager->get(OldUserRepository::class);
// check if there is a fitting user in old user table
$username = GeneralUtility::_GP('user');
/** @var /T3o/T3omy/Domain/Model/OldUser $oldUser */
if ($username) {
$oldUser = $this->oldUserRepository->findOneByUsername(GeneralUtility::_POST('user'));
if ($oldUser) {
$uriBuilder = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
$configurationManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
$configurationManager->setContentObject($frontendLoginController->cObj);
$uriBuilder->injectConfigurationManager($configurationManager);
$uriBuilder->initializeObject();
$oldUser = $this->oldUserRepository->findOneByUsername(GeneralUtility::_POST('user'));
if ($oldUser) {
if ($this->recoverUser($oldUser)) {
$this->oldUserRepository->remove($oldUser);
$this->persistenceManager->persistAll();
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
$uri = $uriBuilder->reset()
->setTargetPageUid(38)
->setTargetPageType(0)
->setTargetPageUid(37)
->setCreateAbsoluteUri(true)
->buildFrontendUri();
// $frontendLoginController->LOCAL_LANG['']
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($uri);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($frontendLoginController->LOCAL_LANG);
// if ($this->recoverUser($oldUser)) {
// $this->oldUserRepository->remove($oldUser);
// $this->persistenceManager->persistAll();
// }
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri, \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
}
}
}
......@@ -81,7 +71,6 @@ class ReactivateUserHook
*/
public function recoverUser(OldUser $oldUser): bool
{
return true;
$userRepository = $this->objectManager->get(UserRepository::class);
$random = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Crypto\Random::class);
......@@ -97,7 +86,7 @@ class ReactivateUserHook
$ldapOperation = $this->objectManager->get(FeManagerHooks::class);
// $ldapOperation->createUser($frontendUser);
$ldapOperation->createUser($frontendUser);
return true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment