Add key parameter to URL generation method.
This commit is contained in:
@ -17,19 +17,21 @@ class CaptchaController extends Controller
|
||||
* Action that is used to generate the captcha, save its code, and stream the image
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param string $key
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function generateCaptchaAction(Request $request)
|
||||
public function generateCaptchaAction(Request $request, $key)
|
||||
{
|
||||
$options = $this->container->getParameter('gregwar_captcha.config');
|
||||
if (!$options['as_url']) {
|
||||
if (!$options['as_url'] || !in_array($key, $options['valid_keys'])) {
|
||||
return $this->createNotFoundException('Unable to generate a captcha via a URL without the proper configuration.');
|
||||
}
|
||||
|
||||
/* @var \Gregwar\CaptchaBundle\Generator\CaptchaGenerator $generator */
|
||||
$generator = $this->container->get('gregwar_captcha.generator');
|
||||
|
||||
return new Response($generator->generate($options));
|
||||
return new Response($generator->generate($key, $options));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user