Skip to content

Commit

Permalink
Fixed issue #6610: Security captcha does not accept valid values
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Sep 30, 2012
1 parent 3803b06 commit dc4594b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions application/controllers/VerificationController.php
Expand Up @@ -21,8 +21,9 @@
*/
class VerificationController extends LSYii_Controller
{
function actionImage()
function actionImage($sid)
{
$iSurveyID=(int)$sid;
Yii::app()->loadHelper('database');
$rootdir = Yii::app()->getConfig('rootdir');

Expand Down Expand Up @@ -101,7 +102,7 @@ function actionImage()
ImageDestroy($im);

// Add the answer to the session
Yii::app()->session['secanswer'] = $num1+$num2;
$_SESSION['survey_'.$iSurveyID]['secanswer'] = $num1+$num2;

This comment has been minimized.

Copy link
@GautamGupta

GautamGupta Oct 1, 2012

Contributor

Other places use Yii::app()->session['secanswer'] to check for the answer. They must be fixed.

This comment has been minimized.

Copy link
@c-schmitz

c-schmitz Oct 1, 2012

Author Contributor

Thank you - totally overlooked that one.

}
}

6 changes: 3 additions & 3 deletions application/helpers/frontend_helper.php
Expand Up @@ -1435,7 +1435,7 @@ function buildsurveysession($surveyid,$previewGroup=false)
if (function_exists("ImageCreate") && isCaptchaEnabled('surveyaccessscreen', $thissurvey['usecaptcha']))
{
echo "<tr>
<td align='center' valign='middle'><label for='captcha'>".$clang->gT("Security question:")."</label></td><td align='left' valign='middle'><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image')."' alt='captcha' /></td>
<td align='center' valign='middle'><label for='captcha'>".$clang->gT("Security question:")."</label></td><td align='left' valign='middle'><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)."' alt='captcha' /></td>
<td valign='middle'><input id='captcha' type='text' size='5' maxlength='3' name='loadsecurity' value='' /></td></tr></table>
</td>
</tr>";
Expand Down Expand Up @@ -1513,7 +1513,7 @@ function buildsurveysession($surveyid,$previewGroup=false)
if (function_exists("ImageCreate") && isCaptchaEnabled('surveyaccessscreen', $thissurvey['usecaptcha']))
{
echo "<li>
<label for='captchaimage'>".$clang->gT("Security Question")."</label><img id='captchaimage' src='".Yii::app()->getController()->createUrl('/verification/image')."' alt='captcha' /><input type='text' size='5' maxlength='3' name='loadsecurity' value='' />
<label for='captchaimage'>".$clang->gT("Security Question")."</label><img id='captchaimage' src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)."' alt='captcha' /><input type='text' size='5' maxlength='3' name='loadsecurity' value='' />
</li>";
}
echo "<li>
Expand Down Expand Up @@ -1684,7 +1684,7 @@ function buildsurveysession($surveyid,$previewGroup=false)
if (function_exists("ImageCreate") && isCaptchaEnabled('surveyaccessscreen', $thissurvey['usecaptcha']))
{
echo "<li>
<label for='captchaimage'>".$clang->gT("Security Question")."</label><img id='captchaimage' src='".Yii::app()->getController()->createUrl('/verification/image')."' alt='captcha' /><input type='text' size='5' maxlength='3' name='loadsecurity' value='' />
<label for='captchaimage'>".$clang->gT("Security Question")."</label><img id='captchaimage' src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)."' alt='captcha' /><input type='text' size='5' maxlength='3' name='loadsecurity' value='' />
</li>";
}
echo "<li><input class='submit' type='submit' value='".$clang->gT("Continue")."' /></li>
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/replacements_helper.php
Expand Up @@ -573,7 +573,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
$_saveform .= "' /></td></tr>\n";
if (isset($thissurvey['usecaptcha']) && function_exists("ImageCreate") && isCaptchaEnabled('saveandloadscreen', $thissurvey['usecaptcha']))
{
$_saveform .="<tr><td align='right'>" . $clang->gT("Security question") . ":</td><td><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image')."' alt='' /></td><td valign='middle' style='text-align:left'><input type='text' size='5' maxlength='3' name='loadsecurity' value='' /></td></tr></table></td></tr>\n";
$_saveform .="<tr><td align='right'>" . $clang->gT("Security question") . ":</td><td><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)."' alt='' /></td><td valign='middle' style='text-align:left'><input type='text' size='5' maxlength='3' name='loadsecurity' value='' /></td></tr></table></td></tr>\n";
}
$_saveform .= "<tr><td align='right'></td><td></td></tr>\n"
. "<tr><td></td><td><input type='submit' id='savebutton' name='savesubmit' value='" . $clang->gT("Save Now") . "' /></td></tr>\n"
Expand All @@ -594,7 +594,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
$_loadform .= "' /></td></tr>\n";
if (isset($thissurvey['usecaptcha']) && function_exists("ImageCreate") && isCaptchaEnabled('saveandloadscreen', $thissurvey['usecaptcha']))
{
$_loadform .="<tr><td align='right'>" . $clang->gT("Security question") . ":</td><td><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image')."' alt='' /></td><td valign='middle'><input type='text' size='5' maxlength='3' name='loadsecurity' value='' alt=''/></td></tr></table></td></tr>\n";
$_loadform .="<tr><td align='right'>" . $clang->gT("Security question") . ":</td><td><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)."' alt='' /></td><td valign='middle'><input type='text' size='5' maxlength='3' name='loadsecurity' value='' alt=''/></td></tr></table></td></tr>\n";
}
$_loadform .="<tr><td align='right'></td><td></td></tr>\n"
. "<tr><td></td><td><input type='submit' id='loadbutton' value='" . $clang->gT("Load now") . "' /></td></tr></table>\n";
Expand Down Expand Up @@ -657,7 +657,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
}
if ((count($registerdata) > 1 || isset($thissurvey['usecaptcha'])) && function_exists("ImageCreate") && isCaptchaEnabled('registrationscreen', $thissurvey['usecaptcha']))
{
$_registerform .="<tr><td align='right'>" . $clang->gT("Security Question") . ":</td><td><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image')."' alt='' /></td><td valign='middle'><input type='text' size='5' maxlength='3' name='loadsecurity' value='' /></td></tr></table></td></tr>\n";
$_registerform .="<tr><td align='right'>" . $clang->gT("Security Question") . ":</td><td><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)."' alt='' /></td><td valign='middle'><input type='text' size='5' maxlength='3' name='loadsecurity' value='' /></td></tr></table></td></tr>\n";
}
$_registerform .= "<tr><td></td><td><input id='registercontinue' class='submit' type='submit' value='" . $clang->gT("Continue") . "' />"
. "</td></tr>\n"
Expand Down
2 changes: 1 addition & 1 deletion application/views/entertoken_view.php
Expand Up @@ -39,7 +39,7 @@
{?>
<li>
<label for='captchaimage'><?php $clang->eT("Security question");?></label>
<img id='captchaimage' src='<?php echo Yii::app()->getController()->createUrl('/verification/image')?>' alt='captcha' />
<img id='captchaimage' src='<?php echo Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)?>' alt='captcha' />
<input type='text' size='5' maxlength='3' name='loadsecurity' value='' />
</li>
<?php
Expand Down

0 comments on commit dc4594b

Please sign in to comment.