Skip to content

Commit

Permalink
Fixed issue #11982: Security question not working
Browse files Browse the repository at this point in the history
Dev: Reset the old captcha to the new one
  • Loading branch information
lacrioque committed Dec 13, 2016
1 parent 9bd9551 commit 723cc10
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions application/controllers/RegisterController.php
Expand Up @@ -138,9 +138,9 @@ public function getRegisterErrors($iSurveyId){
// Check the security question's answer
if (function_exists("ImageCreate") && isCaptchaEnabled('registrationscreen',$aSurveyInfo['usecaptcha']) )
{
$sLoadsecurity=Yii::app()->request->getPost('loadsecurity','');
$sLoadSecurity=Yii::app()->request->getPost('loadsecurity','');
$captcha=Yii::app()->getController()->createAction("captcha");
$captchaCorrect = $captcha->validate( $sLoadsecurity, false);
$captchaCorrect = $captcha->validate( $sLoadSecurity, false);

if (!$captchaCorrect)
{
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/survey/index.php
Expand Up @@ -333,7 +333,7 @@ function action()
{
$sLoadSecurity=Yii::app()->request->getPost('loadsecurity');
$captcha = Yii::app()->getController()->createAction('captcha');
$captchaCorrect = $captcha->validate( $sLoadsecurity, false);
$captchaCorrect = $captcha->validate( $sLoadSecurity, false);

if(empty($sLoadSecurity))
{
Expand Down
30 changes: 20 additions & 10 deletions application/helpers/replacements_helper.php
Expand Up @@ -517,17 +517,27 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de

if (isset($thissurvey['usecaptcha']) && function_exists("ImageCreate") && isCaptchaEnabled('saveandloadscreen', $thissurvey['usecaptcha']))
{
$_loadform .="
<div class='form-group load-survey-row load-survey-captcha'>
<label class='control-label col-sm-3 load-survey-label label-cell' for='loadsecurity'>" . gT("Security question:") . "</label>
<div class='col-sm-2 captcha-image' valign='middle'>
<img src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.((isset($surveyid)) ? $surveyid : ''))."' alt='' />
$_loadform .='<div class="col-sm-12 form-group">
<label class="col-md-4 col-sm-12 control-label">
<p class="col-sm-6 col-md-12 remove-padding">'.gT("Please enter the letters you see below:").'</p>
<span class="col-sm-6 col-md-12">';
$_loadform .=Yii::app()->getController()->widget('CCaptcha',array(
'buttonOptions'=>array('class'=> 'btn btn-xs btn-info'),
'buttonType' => 'button',
'buttonLabel' => gt('Reload image')
),true);
$_loadform .='</span>
</label>
<div class="col-sm-6">
<div>&nbsp;</div>'
. CHtml::textField('loadsecurity', '', array(
'id' => 'captchafield',
'class' => 'text input-sm form-control ',
'required' => 'required'
)).'
</div>
<div class='col-sm-3 captcha-input' valign='middle'>
<input class='form-control' type='text' size='5' maxlength='3' id='loadsecurity' name='loadsecurity' value='' alt=''/>
</div>
</div>
";
</div><br/>';

}

$_loadform .="
Expand Down
1 change: 1 addition & 0 deletions application/libraries/Load_answers.php
Expand Up @@ -33,6 +33,7 @@ function run($args) {

echo CHtml::form(array("/survey/index","sid"=>$surveyid), 'post')."\n";
echo templatereplace(file_get_contents($oTemplate->viewPath."load.pstpl"),array(),$redata);

//PRESENT OPTIONS SCREEN (Replace with Template Later)
//END
echo "<input type='hidden' name='loadall' value='reload' />\n";
Expand Down

2 comments on commit 723cc10

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arg typo ..... ?

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a little bit more than a typo indeed ^^

Please sign in to comment.