Yii2: Captcha color mess

Created on 14 Jan 2018  路  2Comments  路  Source: yiisoft/yii2

What steps will reproduce the problem?

Using the following captcha action config. I just revered the default fore and back colors

public function actions()
 {
    return [
        'error' => [
            'class' => 'yii\web\ErrorAction',
        ],
        'captcha' => [
            'class' => 'yii\captcha\CaptchaAction',
            'fixedVerifyCode' => YII_ENV_TEST ? 'a' : null,
            'maxLength' => 3,
            'minLength' => 1,
            'offset' => 0,
            'backColor' => '0x2040A0',
            'foreColor' => '0xFFFFFF'
        ],
    ];
}`

What is the expected result?

A captcha with white font and blue background

What do you get instead?

Black background and font

Additional info

| Q | A
| ---------------- | ---
| Yii version | 2.0.13.1
| PHP version | 7.0.8
| Operating system | Win7

Most helpful comment

@Kolyunya is right: backColor and foreColor are just numbers (Source).
@esaesa just remove the quotes around the color codes.
yii2

All 2 comments

backColor and foreColor expect values of integer type, not strings. Not sure if that's the source of the problem though.

@Kolyunya is right: backColor and foreColor are just numbers (Source).
@esaesa just remove the quotes around the color codes.
yii2

Was this page helpful?
0 / 5 - 0 ratings