Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Invisible Recaptcha (#18146)
- Loading branch information
Rene Pasing
authored and
Michael Babker
committed
Aug 28, 2018
1 parent
6d1e90f
commit 9a12f28
Showing
50 changed files
with
1,716 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/mysql/3.9.0-2018-08-29.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES | ||
(494, 0, 'plg_captcha_recaptcha_invisible', 'plugin', 'recaptcha_invisible', 'captcha', 0, 0, 1, 0, '', '{"public_key":"","private_key":"","theme":"clean"}', '', '', 0, '0000-00-00 00:00:00', 0, 0); |
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/postgresql/3.9.0-2018-08-29.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES | ||
(494, 0, 'plg_captcha_recaptcha_invisible', 'plugin', 'recaptcha_invisible', 'captcha', 0, 0, 1, 0, '', '{"public_key":"","private_key":"","theme":"clean"}', '', '', 0, '1970-01-01 00:00:00', 0, 0); |
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/sqlazure/3.9.0-2018-08-29.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES | ||
(494, 0, 'plg_captcha_recaptcha_invisible', 'plugin', 'recaptcha_invisible', 'captcha', 0, 0, 1, 0, '', '{"public_key":"","private_key":"","theme":"clean"}', '', '', 0, '1900-01-01 00:00:00', 0, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
administrator/language/en-GB/en-GB.plg_captcha_recaptcha_invisible.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
; Joomla! Project | ||
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved. | ||
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_CAPTCHA_RECAPTCHA_INVISIBLE_XML_DESCRIPTION="This CAPTCHA plugin uses the Invisible reCAPTCHA service. To get a site and secret key for your domain, go to <a href="_QQ_"https://www.google.com/recaptcha"_QQ_" target="_QQ_"_blank"_QQ_">https://www.google.com/recaptcha</a>." | ||
PLG_CAPTCHA_RECAPTCHA_INVISIBLE="CAPTCHA - Invisible reCAPTCHA " | ||
|
||
; Params | ||
PLG_RECAPTCHA_INVISIBLE_PUBLIC_KEY_LABEL="Site Key" | ||
PLG_RECAPTCHA_INVISIBLE_PUBLIC_KEY_DESC="Used in the JavaScript code that is served to your users." | ||
PLG_RECAPTCHA_INVISIBLE_PRIVATE_KEY_LABEL="Secret Key" | ||
PLG_RECAPTCHA_INVISIBLE_PRIVATE_KEY_DESC="Used in the communication between your server and the reCAPTCHA server. Be sure to keep it a secret." | ||
PLG_RECAPTCHA_INVISIBLE_BADGE_LABEL="Badge" | ||
PLG_RECAPTCHA_INVISIBLE_BADGE_DESC="Positioning of the reCAPTCHA badge." | ||
PLG_RECAPTCHA_INVISIBLE_BADGE_BOTTOMRIGHT="Bottom right" | ||
PLG_RECAPTCHA_INVISIBLE_BADGE_BOTTOMLEFT="Bottom left" | ||
PLG_RECAPTCHA_INVISIBLE_BADGE_INLINE="Inline" | ||
PLG_RECAPTCHA_INVISIBLE_TABINDEX_LABEL="Tabindex" | ||
PLG_RECAPTCHA_INVISIBLE_TABINDEX_DESC="The tabindex of the challenge." | ||
PLG_RECAPTCHA_INVISIBLE_CALLBACK_LABEL="Callback" | ||
PLG_RECAPTCHA_INVISIBLE_CALLBACK_DESC="(Optional) JavaScript callback, executed after successful reCAPTCHA response" | ||
PLG_RECAPTCHA_INVISIBLE_EXPIRED_CALLBACK_LABEL="Expired callback" | ||
PLG_RECAPTCHA_INVISIBLE_EXPIRED_CALLBACK_DESC="(Optional) JavaScript callback, executed when the reCAPTCHA expired" | ||
PLG_RECAPTCHA_INVISIBLE_ERROR_CALLBACK_LABEL="Error callback" | ||
PLG_RECAPTCHA_INVISIBLE_ERROR_CALLBACK_DESC="(Optional) JavaScript callback, executed when the reCAPTCHA encounters an error" | ||
|
||
; Error messages | ||
PLG_RECAPTCHA_INVISIBLE_ERROR_NO_PRIVATE_KEY="reCAPTCHA plugin needs a secret key to be set in its parameters. Please contact a site administrator." | ||
PLG_RECAPTCHA_INVISIBLE_ERROR_NO_PUBLIC_KEY="reCAPTCHA plugin needs a site key to be set in its parameters. Please contact a site administrator." | ||
PLG_RECAPTCHA_INVISIBLE_ERROR_EMPTY_SOLUTION="Empty solution not allowed." | ||
PLG_RECAPTCHA_INVISIBLE_ERROR_NO_IP="For security reasons, you must pass the remote IP address to reCAPTCHA." |
7 changes: 7 additions & 0 deletions
7
administrator/language/en-GB/en-GB.plg_captcha_recaptcha_invisible.sys.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; Joomla! Project | ||
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved. | ||
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_CAPTCHA_RECAPTCHA_INVISIBLE_XML_DESCRIPTION="This CAPTCHA plugin uses the Invisible reCAPTCHA service. To get a site and secret key for your domain, go to <a href="_QQ_"https://www.google.com/recaptcha"_QQ_" target="_QQ_"_blank"_QQ_">https://www.google.com/recaptcha</a>." | ||
PLG_CAPTCHA_RECAPTCHA_INVISIBLE="CAPTCHA - Invisible reCAPTCHA " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Site | ||
* @subpackage Layout | ||
* | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('JPATH_BASE') or die; | ||
|
||
extract($displayData); | ||
|
||
/** | ||
* Layout variables | ||
* --------------------- | ||
* $options : (array) Optional parameters | ||
* $label : (string) The html code for the label (not required if $options['hiddenLabel'] is true) | ||
* $input : (string) The input field html code | ||
*/ | ||
|
||
if (!empty($options['showonEnabled'])) | ||
{ | ||
JHtml::_('jquery.framework'); | ||
JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); | ||
} | ||
|
||
$class = empty($options['class']) ? '' : ' ' . $options['class']; | ||
$rel = empty($options['rel']) ? '' : ' ' . $options['rel']; | ||
|
||
/** | ||
* @TODO: | ||
* | ||
* As mentioned in #8473 (https://github.com/joomla/joomla-cms/pull/8473), ... | ||
* as long as we cannot access the field properties properly, this seems to | ||
* be the way to go for now. | ||
* | ||
* On a side note: Parsing html is seldom a good idea. | ||
* https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 | ||
*/ | ||
preg_match('/class=\"([^\"]+)\"/i', $input, $match); | ||
|
||
$required = (strpos($input, 'aria-required="true"') !== false || (!empty($match[1]) && strpos($match[1], 'required') !== false)); | ||
$typeOfSpacer = (strpos($label, 'spacer-lbl') !== false); | ||
|
||
?> | ||
|
||
<div class="control-group<?php echo $class; ?>"<?php echo $rel; ?>> | ||
<?php if (empty($options['hiddenLabel'])): ?> | ||
<div class="control-label"> | ||
<?php echo $label; ?> | ||
<?php if (!$required && !$typeOfSpacer) : ?> | ||
<span class="optional"><?php echo JText::_('COM_USERS_OPTIONAL'); ?></span> | ||
<?php endif; ?> | ||
</div> | ||
<?php endif; ?> | ||
<div class="controls"> | ||
<?php echo $input; ?> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.