-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add field validation for recaptcha action names
- Loading branch information
Christopher Mühl
committed
May 24, 2019
1 parent
310e861
commit 7eb5e86
Showing
6 changed files
with
22 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Contao; | ||
|
||
class RecaptchaHooks | ||
{ | ||
public function addRecaptchaActionRegexp($regexpName, $value, Widget $widget) | ||
{ | ||
if ($regexpName !== 'recaptcha') return false; | ||
|
||
if (preg_match('/[^a-zA-Z\/_]/', $value) !== 0) { | ||
$widget->addError($GLOBALS['TL_LANG']['ERR']['recaptcha_rgxp']); | ||
} | ||
|
||
return true; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?php | ||
|
||
$GLOBALS['TL_LANG']['ERR']['recaptcha'] = "reCAPTCHA konnte nicht bestätigen, dass Sie kein Roboter sind. Bitte versuchen Sie es noch einmal."; | ||
$GLOBALS['TL_LANG']['ERR']['recaptcha_rgxp'] = "reCAPTCHA Aktionen können nur die Buchstaben a-z (klein- und großgeschrieben), sowie die Zeichen _ und / enthalten."; | ||
|
||
$GLOBALS['TL_LANG']['CTE']['miscellaneous'] = "Verschiedenes"; | ||
$GLOBALS['TL_LANG']['CTE']['backgroundrecaptcha'][0] = "Hintergrund reCAPTCHA v3"; |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?php | ||
|
||
$GLOBALS['TL_LANG']['ERR']['recaptcha'] = "reCAPTCHA could not verify that you're not a robot. Please try again."; | ||
$GLOBALS['TL_LANG']['ERR']['recaptcha_rgxp'] = "reCAPTCHA actions can only include the letters a-z (lower and upper case) and the symbols _ and /."; | ||
|
||
$GLOBALS['TL_LANG']['CTE']['miscellaneous'] = "Miscellaneous"; | ||
$GLOBALS['TL_LANG']['CTE']['backgroundrecaptcha'][0] = "Background reCAPTCHA v3"; |