Thank you for good question!
This is from /protected/controllers/SiteController.php
public function actions() {
return array(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha' => array(
'class' => 'CCaptchaAction',
'backColor' => 0xFFFFFF,
),
// page action renders "static" pages stored under 'protected/views/site/pages'
// They can be accessed via: index.php?r=site/page&view=FileName
'page' => array(
'class' => 'CViewAction',
),
);
}
In SiteController there is this actions method. (This code is generated by yii).
Now I add this in my controller
public function actions() {
return array(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha' => array(
'class' => 'CCaptchaAction',
'backColor' => 0xFFFFFF,
),
);
}
BUT this is not enough
Image is the resutl of a link like
http://localhost/****/index.php?r=****/captcha&v=*****
So… we can also add the right rules like:
public function accessRules() {
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array('create', 'welcome','captcha'),
'users' => array('*'),
),
array('allow', // allow all users to perform 'index' and 'view' actions
'actions' => array('admin', 'delete', 'update', 'view'),
'roles' => array('editContent'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}