mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 12:44:20 +01:00
Compare commits
1 Commits
cec618e3c5
...
php
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3192fb6c83 |
@@ -72,8 +72,11 @@ class QuizController extends AbstractController
|
|||||||
$candidate = $candidateRepository->getCandidateByHash($season, $nameHash);
|
$candidate = $candidateRepository->getCandidateByHash($season, $nameHash);
|
||||||
|
|
||||||
if (!$candidate instanceof Candidate) {
|
if (!$candidate instanceof Candidate) {
|
||||||
// Add option to add new candidate when preregister is disabled
|
if ($season->isPreregisterCandidates() === false) {
|
||||||
$this->addFlash(FlashType::Danger->value, 'Candidate not found');
|
// create candidate
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addFlash(FlashType::Danger->value, "Candidate {${Base64::base64_url_decode($nameHash)}} not found");
|
||||||
|
|
||||||
return $this->redirectToRoute('enter_name', ['seasonCode' => $season->getSeasonCode()]);
|
return $this->redirectToRoute('enter_name', ['seasonCode' => $season->getSeasonCode()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
use Safe\Exceptions\UrlException;
|
use Safe\Exceptions\UrlException;
|
||||||
|
use function rtrim;
|
||||||
|
|
||||||
class Base64
|
class Base64
|
||||||
{
|
{
|
||||||
@@ -12,14 +13,22 @@ class Base64
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function base64_url_encode(string $input): string
|
/**
|
||||||
|
* @param string $name name to hash
|
||||||
|
* @return string hashed name
|
||||||
|
*/
|
||||||
|
public static function base64_url_encode(string $name): string
|
||||||
{
|
{
|
||||||
return strtr(base64_encode($input), '+/', '-_');
|
return rtrim(strtr(base64_encode($name), '+/', '-_'), '=');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @throws UrlException */
|
/**
|
||||||
public static function base64_url_decode(string $input): string
|
* @param string $hash hashed name
|
||||||
|
* @return string plaintext name
|
||||||
|
* @throws UrlException
|
||||||
|
*/
|
||||||
|
public static function base64_url_decode(string $hash): string
|
||||||
{
|
{
|
||||||
return \Safe\base64_decode(strtr($input, '-_', '+/'), true);
|
return \Safe\base64_decode(strtr($hash, '-_', '+/'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user