CaptchaBundle: about set as_url get error

hey, i’m set as_url = true,but i can’t get the captcha?

app/config/config.yml

gregwar_captcha:
    expiration: 120
    width: 300
    height: 180
    length: 6
    as_url: true
    text_color: [255, 0, 255]
    background_color: [255, 255, 255]
    ignore_all_effects: false
    distortion: false
    interpolation: false
    charset: 'abcdefhjkmnprstuvwxyz'

it didn’t work at9d8 n918g 9dpae5 x pt

so,i debug

class CaptchaController extends Controller
{
    /**
     * Action that is used to generate the captcha, save its code, and stream the image
     *
     * @param string $key
     *
     * @return Response
     *
     * @throws NotFoundHttpException
     */
    public function generateCaptchaAction($key)
    {
        $options = $this->container->getParameter('gregwar_captcha.config');
        $session = $this->get('session');
        $whitelistKey = $options['whitelist_key'];
        $isOk = false;
        dump($session->has($whitelistKey));
        if ($session->has($whitelistKey)) {
            $keys = $session->get($whitelistKey);
            dump($keys);
            if (is_array($keys) && in_array($key, $keys)) {
                $isOk = true;
            }
        }
        dump($isOk);die();
        if (!$isOk) {
            return $this->error($options);
        }

i got

CaptchaController.php on line 31:
false
CaptchaController.php on line 39:
false

whitelist_key default value is ‘captcha_whitelist_key’ get session value fail

where set the sesssion and how config keys $keys = $session->get($whitelistKey); in_array check? thanks

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

about set background_images:

gregwar_captcha:
    expiration: 120
    width: 300
    height: 180
    length: 6
    as_url: true
    text_color: [255, 0, 255]
    background_color: [255, 255, 255]
    ignore_all_effects: false
    distortion: true
    interpolation: true
    charset: 'abcdefhjkmnprstuvwxyz'
    background_images: ["%kernel.root_dir%/../web/static/images/captcha_bg.jpg", "%kernel.root_dir%/../web/static/images/captcha_bg.jpg"]

I got error. o sa_8 3nh97 xlso15cfh

thanks