Skip to content

Commit

Permalink
added recaptcha support over https
Browse files Browse the repository at this point in the history
  • Loading branch information
frithjof committed Jul 20, 2015
1 parent bb5eb1c commit 41f22ae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Formbuilder/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ public function getForm($name, $locale=null, $dynamic=false) {
} else {
$form = $this->getDynamicForm($id, $locale);
}
//correctly set recaptcha to https if request is over https
if(Zend_Controller_Front::getInstance()->getRequest()->isSecure()){
/**@var Zend_Form $form */
$elements = $form->getElements();
foreach($elements as $element){
if(get_class($element) == 'Zend_Form_Element_Captcha' ){
/**@var Zend_Form_Element_Captcha $element */
$cap = $element->getCaptcha();
$cap->getService()->setParams(array('ssl'=>true));
}
}
}

return $form;
} else {
Expand Down

0 comments on commit 41f22ae

Please sign in to comment.