Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions classes/MagicForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ abstract class MagicForm extends ComponentBase

public function onRun() {

$this->page['recaptcha_enabled'] = $this->isReCaptchaEnabled();
$this->page['recaptcha_misconfigured'] = $this->isReCaptchaMisconfigured();
$this->recaptcha_enabled = $this->isReCaptchaEnabled();
$this->page['recaptcha_enabled'] = $this->page['recaptcha_enabled'] || $this->isReCaptchaEnabled();
$this->page['recaptcha_misconfigured'] = $this->page['recaptcha_misconfigured'] || $this->isReCaptchaMisconfigured();

if ($this->isReCaptchaEnabled()) {
$this->loadReCaptcha();
Expand Down
4 changes: 2 additions & 2 deletions classes/ReCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public function init() {
}

private function isReCaptchaEnabled() {
return ($this->property('recaptcha_enabled') && Settings::get('recaptcha_site_key') != '' && Settings::get('recaptcha_secret_key') != '');
return $this->property('recaptcha_enabled') && !$this->isReCaptchaMisconfigured();
}

private function isReCaptchaMisconfigured() {
return ($this->property('recaptcha_enabled') && (Settings::get('recaptcha_site_key') == '' || Settings::get('recaptcha_secret_key') == ''));
return Settings::get('recaptcha_site_key') == '' || Settings::get('recaptcha_secret_key') == '';
}

private function getReCaptchaLang($lang='') {
Expand Down
1 change: 1 addition & 0 deletions classes/SharedProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Lang;

trait SharedProperties {
public $recaptcha_enabled = false;

public function defineProperties() {
return [
Expand Down
4 changes: 2 additions & 2 deletions components/partials/recaptcha.htm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if (recaptcha_enabled) %}
{% if (__SELF__.recaptcha_enabled) %}
<div id="{{ __SELF__ }}" class="g-recaptcha" data-sitekey="{{ __SELF__.settings.recaptcha_site_key }}" data-theme="{{ __SELF__.property('recaptcha_theme') }}" data-type="{{ __SELF__.property('recaptcha_type') }}" data-size="{{ __SELF__.property('recaptcha_size') }}"></div>
{% elseif (recaptcha_misconfigured) %}
<h5>{{ recaptcha_warn }}</h5>
{% endif %}
{% endif %}