string csrfToken(string $tokenId)
Returns a CSRF token.
Use this helper for CSRF protection without the overhead of creating a form.
echo $view['form']->csrfToken('rmuser'.$user->getId());
Check the token in your action using the same CSRF token id.
$csrfProvider = $this->get('security.csrf.tokengenerator');
if (!$csrfProvider->isCsrfTokenValid('rmuser_'.$user->getId(), $token)) {
throw new \RuntimeException('CSRF attack detected.');
}
Please login to continue.