Commit c7a1f036 authored by Stefan Busemann's avatar Stefan Busemann

[BUGFIX] fix cgl errors

parent 0a866a9e
Pipeline #4902 passed with stages
in 8 minutes and 11 seconds
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\T3omy\Controller;
......@@ -7,11 +7,11 @@ use In2code\Femanager\Domain\Model\User;
use In2code\Femanager\Domain\Repository\UserRepository;
use T3o\T3omy\Domain\Model\OldUser;
use T3o\T3omy\Domain\Repository\OldUserRepository;
use T3o\T3omy\Hooks\FeManagerHooks;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
use T3o\T3omy\Hooks\FeManagerHooks;
/**
* Class UserController
......@@ -49,13 +49,12 @@ class OldUserController extends ActionController
$this->persistenceManager = $persistenceManager;
}
function reactivateOldUser($funcRef, $params)
public function reactivateOldUser($funcRef, $params)
{
$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
/** @var /T3o/T3omy/Domain/Model/OldUser $oldUser * */
$oldUser = $this->oldUserRepository->findByUsername(GeneralUtility::_POST('user'));
......@@ -66,11 +65,10 @@ class OldUserController extends ActionController
$this->persistenceManager->persistAll();
}
// @fixme ?id must be configurable
header('Location:' . $_SERVER['HTTP_HOST']. '?id=37');
header('Location:' . $_SERVER['HTTP_HOST'] . '?id=37');
}
}
/**
* @param OldUser $oldUser
* @return bool
......@@ -85,7 +83,7 @@ class OldUserController extends ActionController
$frontendUser->setUsername($oldUser->getUsername());
$frontendUser->setEmail($oldUser->getEmail());
$frontendUser->setName($oldUser->getUsername());
$frontendUser->setPassword(md5($oldUser->getEmail().rand(459,9999999)));
$frontendUser->setPassword(md5($oldUser->getEmail() . rand(459, 9999999)));
$userRepository->add($frontendUser);
$this->persistenceManager->persistAll();
......@@ -94,14 +92,12 @@ class OldUserController extends ActionController
$LdapOperation->createUser($frontendUser);
return true;
}
function siteURL()
public function siteURL()
{
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$domainName = $_SERVER['HTTP_HOST'].'/';
return $protocol.$domainName;
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
$domainName = $_SERVER['HTTP_HOST'] . '/';
return $protocol . $domainName;
}
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\T3omy\Domain\Model;
/**
* Class UserProfileRepository
*/
class OldUser extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
class OldUser extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
......
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\T3omy\Domain\Repository;
use TYPO3\CMS\Extbase\Persistence\Repository;
......@@ -24,5 +24,4 @@ class OldUserRepository extends Repository
return $query->matching($query->equals('username', $username))->execute()->getFirst();
}
}
......@@ -30,7 +30,6 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
use TYPO3\CMS\Extbase\Utility\LocalizationUxtility;
use TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface;
/**
......@@ -43,7 +42,6 @@ class RecordListWorkflowOldUsers implements RecordListHookInterface
*/
protected $iconFactory;
/**
* RecordListWorkflowButton constructor.
*/
......@@ -86,13 +84,9 @@ class RecordListWorkflowOldUsers implements RecordListHookInterface
$cells['primary'] = $buttons + $cells['primary'];
}
return $cells;
}
/**
*
* @return string
*/
protected function getWorkflowButton()
......@@ -115,8 +109,6 @@ class RecordListWorkflowOldUsers implements RecordListHookInterface
. '</a>';
}
/**
* @param string $table
* @param array $currentIdList
......
......@@ -55,11 +55,10 @@ $dispatcher->connect(
/**
* Register hooks
*
*/
// Hook to update Password in LDAP -> if password reset was fullfilled
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['password_changed'][] = \T3o\T3omy\Hooks\FeManagerHooks::class . '->writePassword';
// Hook to look, if a user does exist in "old_users" table
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_error'][] = \T3o\T3omy\Controller\OldUserController::class . '->reactivateOldUser';
\ No newline at end of file
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_error'][] = \T3o\T3omy\Controller\OldUserController::class . '->reactivateOldUser';
Markdown is supported
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