Skip to content

Commit

Permalink
[TASK] Replace GeneralUtility::hmac() usage in MiscUtility
Browse files Browse the repository at this point in the history
  • Loading branch information
derhansen committed Sep 16, 2024
1 parent df5bb63 commit b421a74
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Classes/Utility/MiscUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace DERHANSEN\SfEventMgt\Utility;

use TYPO3\CMS\Core\Crypto\HashService;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand All @@ -23,10 +24,12 @@ class MiscUtility
*/
public static function getSpamCheckChallenge(int $eventUid): string
{
$hmac = GeneralUtility::hmac('event-' . $eventUid, 'sf_event_mgt');
/** @var HashService $hashService */
$hashService = GeneralUtility::makeInstance(HashService::class);
$hmac = $hashService->hmac('event-' . $eventUid, 'sf_event_mgt');
$chars = preg_replace('/[0-9]+/', '', $hmac);

return preg_replace_callback('/\w.?/', function ($m) {
return preg_replace_callback('/\w.?/', static function ($m) {
return ucfirst($m[0]);
}, $chars);
}
Expand Down

0 comments on commit b421a74

Please sign in to comment.