Update CSRF Token IDs for Issue kevinpapst/kimai2#2947 (#2948)
* bump version * removed not needed token, as it is already contained in the form Co-authored-by: Kevin Papst <kpapst@gmx.net>
This commit is contained in:
@@ -21,8 +21,6 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Csrf\CsrfToken;
|
||||
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
|
||||
|
||||
/**
|
||||
* @Route(path="/timesheet")
|
||||
@@ -62,20 +60,12 @@ class TimesheetController extends TimesheetAbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route(path="/{id}/duplicate/{token}", name="timesheet_duplicate", methods={"GET", "POST"})
|
||||
* @Route(path="/{id}/duplicate", name="timesheet_duplicate", methods={"GET", "POST"})
|
||||
* @Security("is_granted('duplicate', entry)")
|
||||
*/
|
||||
public function duplicateAction(Timesheet $entry, Request $request, string $token, CsrfTokenManagerInterface $csrfTokenManager): Response
|
||||
public function duplicateAction(Timesheet $entry, Request $request): Response
|
||||
{
|
||||
if (!$csrfTokenManager->isTokenValid(new CsrfToken('timesheet.duplicate', $token))) {
|
||||
$this->flashError('action.csrf.error');
|
||||
|
||||
return $this->redirectToRoute('timesheet');
|
||||
}
|
||||
|
||||
$csrfTokenManager->refreshToken($token);
|
||||
|
||||
return $this->duplicate($entry, $request, 'timesheet/edit.html.twig', $token);
|
||||
return $this->duplicate($entry, $request, 'timesheet/edit.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,8 +100,8 @@ class TimesheetController extends TimesheetAbstractController
|
||||
return $this->generateCreateForm($entry, TimesheetEditForm::class, $this->generateUrl('timesheet_create'));
|
||||
}
|
||||
|
||||
protected function getDuplicateForm(Timesheet $entry, Timesheet $original, string $token): FormInterface
|
||||
protected function getDuplicateForm(Timesheet $entry, Timesheet $original): FormInterface
|
||||
{
|
||||
return $this->generateCreateForm($entry, TimesheetEditForm::class, $this->generateUrl('timesheet_duplicate', ['id' => $original->getId(), 'token' => $token]));
|
||||
return $this->generateCreateForm($entry, TimesheetEditForm::class, $this->generateUrl('timesheet_duplicate', ['id' => $original->getId()]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user