I’m using the captcha widget on a few different pages, but it only works on one. After viewing the page source I found that the url to the captcha image is wrong on the pages where it’s broken. Here is the relevant code I’m using:
Page url: /project/site
Model:
public function rules()
{
return array(
// username and password are required
array('email, password, domain', 'required'),
// rememberMe needs to be a boolean
//array('rememberMe', 'boolean'),
array('email', 'email'),
// password needs to be authenticated
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
);
}
Controller:
$model->attributes=$_POST['LicenseeForm'];
if($model->validate())
View:
<?php if(CCaptcha::checkRequirements()): ?>
<div class="row">
<?php echo $form->labelEx($model,'verifyCode'); ?>
<div>
<?php $this->widget('CCaptcha'); ?>
<?php echo $form->textField($model,'verifyCode'); ?>
</div>
<div class="hint">Please enter the letters as they are shown in the image above.
<br/>Letters are not case-sensitive.</div>
</div>
<?php endif; ?>
I used the same code for the captcha on a controller / view whose url is: project/licensee
The url path for the ‘site’ captcha is:
<img id="yw1" src="/project/site/captcha?v=4dff904058a6b" alt="" />
The url path for the ‘licensee’ captcha is (the image does not show up):
<img id="yw1" src="/project/licensee/captcha?v=4dff904058a6b" alt="" />
How can I specify the image path of the captcha image?