Commit 728bd2d9 authored by Tino Goratsch's avatar Tino Goratsch

display the recaptcha specific settings

parent 20bf3739
<?php
/**
* Copyright (c) 2017 by the ACP3 Developers.
* See the LICENCE file at the top-level module directory for licencing details.
*/
namespace ACP3\Modules\ACP3\Captcha\Event\Listener;
use ACP3\Core\View;
use ACP3\Core\View\Event\TemplateEvent;
class OnCaptchaAdminSettingsCustomFieldsListener
{
/**
* @var View
*/
private $view;
/**
* OnCaptchaAdminSettingsCustomFieldsListener constructor.
* @param View $view
*/
public function __construct(View $view)
{
$this->view = $view;
}
/**
* @param TemplateEvent $event
*/
public function renderRecaptchaSettings(TemplateEvent $event)
{
$params = $event->getParameters();
$this->view->assign('form', $params['form']);
$this->view->displayTemplate('Captcha/Partials/captcha_recaptcha.admin_settings.tpl');
}
}
/*
* Copyright (c) 2017 by the ACP3 Developers.
* See the LICENCE file at the top-level module directory for licencing details.
*/
jQuery(document).ready(function ($) {
var $recaptchaWrapper = $('#recaptcha-wrapper');
$('#captcha').on('change', function() {
$recaptchaWrapper.toggle(this.value === 'captcha.extension.recaptcha_captcha_extension');
}).filter(':selected').triggerHandler('change');
});
<div id="recaptcha-wrapper">
{include file="asset:System/Partials/form_group.input_password.tpl" name="recaptcha_sitekey" value=$form.recaptcha_sitekey labelRequired=true label={lang t="captcha|recaptcha_sitekey"}}
{include file="asset:System/Partials/form_group.input_password.tpl" name="recaptcha_secret" value=$form.recaptcha_secret labelRequired=true label={lang t="captcha|recaptcha_secret"}}
</div>
{javascripts}
{include_js module="captcha" file="partials/recaptcha.admin-settings"}
{/javascripts}
......@@ -7,6 +7,13 @@ services:
tags:
- { name: core.eventListener, event: captcha.event.display_captcha, method: onDisplayCaptcha }
captcha.event.on_captcha_admin_settings_custom_fields_listener:
class: ACP3\Modules\ACP3\Captcha\Event\Listener\OnCaptchaAdminSettingsCustomFieldsListener
arguments:
- '@core.view'
tags:
- { name: core.eventListener, event: captcha.admin_settings.custom_fields, method: renderRecaptchaSettings }
captcha.event.on_captcha_validation_validate_captcha_listener:
class: ACP3\Modules\ACP3\Captcha\Event\Listener\OnCaptchaValidationValidateCaptchaListener
arguments:
......
......@@ -12,6 +12,8 @@
<item key="mod_description">Captchas bieten wirkungsvollen Schutz gegen Spambots.</item>
<item key="native">ACP3-Nativ</item>
<item key="recaptcha">reCAPTCHA</item>
<item key="recaptcha_secret">reCAPTCHA Secret</item>
<item key="recaptcha_sitekey">reCAPTCHA Sitekey</item>
<item key="select_captcha_type">Bitte wählen Sie den zu verwendenten Captcha-Typen aus.</item>
</keys>
</language>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment