Commit 1b6e054e authored by Oliver Eglseder's avatar Oliver Eglseder

[TASK] Filter test requests

parent 949e70f3
......@@ -31,11 +31,36 @@ class FeElectionController extends ActionController
*/
protected $hashService = null;
/**
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentNameException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
*/
public function initializeVoteAction()
{
if ($this->request->hasArgument('electionInvitation')) {
$electionInvitation = $this->request->getArgument('electionInvitation');
if ($electionInvitation === '-1') {
$this->response->appendContent('TEST SUCCESSFUL');
$this->request->setArgument('electionInvitation', null);
$this->actionMethodName = 'voidAction';
}
}
}
/**
*
*/
public function voidAction()
{
return '';
}
/**
* @param ElectionInvitation $electionInvitation
* @param string $hmac
* @return string
*/
public function voteAction(ElectionInvitation $electionInvitation, $hmac)
public function voteAction(ElectionInvitation $electionInvitation = null, $hmac = '')
{
$saltedEmail = $electionInvitation->getSecret() . $electionInvitation->getElector()->getEmail();
if ($this->hashService->validateHmac($saltedEmail, $hmac)) {
......
......@@ -21,6 +21,7 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Security\Cryptography\HashService;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
use TYPO3\Election\Controller\FeElectionController;
use TYPO3\Election\Domain\Repository\ConfigurationRepository;
/**
* Class ElectionCircular
......@@ -102,11 +103,12 @@ class ElectionCircular extends AbstractEntity
$dummyElector->setEmail('kasper@typo3.org');
$dummyElectionInvitation = new ElectionInvitation();
$dummyElectionInvitation->setElector($dummyElector);
$dummyElectionInvitation->_setProperty('uid', 9999999);
$dummyElectionInvitation->_setProperty('uid', -1);
$dummyElectionInvitation->setSecret('foooBAAAAArrrrr');
$dummyConfiguration = new Configuration();
$dummyConfiguration->setPluginPid(1);
return $this->getRenderedBody($dummyConfiguration, $dummyElectionInvitation);
return $this->getRenderedBody(
GeneralUtility::makeInstance(ObjectManager::class)->get(ConfigurationRepository::class)->findCurrent(),
$dummyElectionInvitation
);
}
/**
......
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