From c7fd3e1167b6f2fa7746edbd0fb8f8c1694c61f9 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 24 Mar 2016 11:54:39 +0100 Subject: Added TReCaptcha2 and wrote doc; fix #560 --- .../protected/pages/Controls/ReCaptcha.page | 37 ++++++++++++++++++++++ .../protected/pages/Controls/ReCaptcha2.page | 37 ++++++++++++++++++++++ .../pages/Controls/Samples/TReCaptcha/Home.page | 17 ++++++++++ .../pages/Controls/Samples/TReCaptcha/Home.php | 11 +++++++ .../pages/Controls/Samples/TReCaptcha2/Home.page | 17 ++++++++++ .../pages/Controls/Samples/TReCaptcha2/Home.php | 11 +++++++ .../protected/pages/Controls/Standard.page | 8 +++++ 7 files changed, 138 insertions(+) create mode 100644 demos/quickstart/protected/pages/Controls/ReCaptcha.page create mode 100644 demos/quickstart/protected/pages/Controls/ReCaptcha2.page create mode 100755 demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.page create mode 100755 demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.php create mode 100755 demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.page create mode 100755 demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.php (limited to 'demos/quickstart/protected/pages') diff --git a/demos/quickstart/protected/pages/Controls/ReCaptcha.page b/demos/quickstart/protected/pages/Controls/ReCaptcha.page new file mode 100644 index 00000000..0735bb9e --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/ReCaptcha.page @@ -0,0 +1,37 @@ + + +

TReCaptcha

+ + +

+TReCaptcha displays a reCAPTCHA v1 that can be used to determine if the input is entered by a real user instead of some program. It can also prevent multiple submits of the same form either by accident, or on purpose (ie. spamming). +

+ +

+The reCAPTCHA to solve (a string consisting of two separate words) displayed is automatically generated by the reCAPTCHA system at recaptcha.net. However, in order to use the services of the site you will need to register and get a public and a private API key pair, and supply those to the reCAPTCHA control through setting the PrivateKey and PublicKey properties. +

+ +

+Currently the reCAPTCHA API supports only one reCAPTCHA field per page, so you MUST make sure that all your input is protected and validated by a single reCAPTCHA control. Placing more than one reCAPTCHA control on the page will lead to unpredictable results, and the user will most likely unable to solve any of them successfully. +

+ +

+Upon postback, user input can be validated by calling validate(). The TReCaptchaValidator control can also be used to do validation, which provides server-side validation. Calling validate() will invalidate the token supplied, so all consecutive calls to the method - without solving a new captcha - will return false. Therefore if implementing a multi-stage input process, you must make sure that you call validate() only once, either at the end of the input process, or you store the result till the end of the processing. +

+ +

+The following template shows a typical use of TReCaptcha control: +

+ + +<com:TReCaptcha ID="Captcha" + PublicKey="..." + PrivateKey="..." +/> +<com:TReCaptchaValidator ControlToValidate="Captcha" + ErrorMessage="You are challenged!" /> + + + + +
diff --git a/demos/quickstart/protected/pages/Controls/ReCaptcha2.page b/demos/quickstart/protected/pages/Controls/ReCaptcha2.page new file mode 100644 index 00000000..dd87a22d --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/ReCaptcha2.page @@ -0,0 +1,37 @@ + + +

TReCaptcha

+ + +

+TReCaptcha displays a reCAPTCHA v2 that can be used to determine if the input is entered by a real user instead of some program. It can also prevent multiple submits of the same form either by accident, or on purpose (ie. spamming). +

+ +

+The reCAPTCHA to solve (a string consisting of two separate words) displayed is automatically generated by the reCAPTCHA system at recaptcha.net. However, in order to use the services of the site you will need to register and get a public and a private API key pair, and supply those to the reCAPTCHA control through setting the SecretKey and SiteKey properties. +

+ +

+Currently the reCAPTCHA API supports only one reCAPTCHA field per page, so you MUST make sure that all your input is protected and validated by a single reCAPTCHA control. Placing more than one reCAPTCHA control on the page will lead to unpredictable results, and the user will most likely unable to solve any of them successfully. +

+ +

+Upon postback, user input can be validated by calling validate(). The TReCaptcha2Validator control can also be used to do validation, which provides server-side validation. Calling validate() will invalidate the token supplied, so all consecutive calls to the method - without solving a new captcha - will return false. Therefore if implementing a multi-stage input process, you must make sure that you call validate() only once, either at the end of the input process, or you store the result till the end of the processing. +

+ +

+The following template shows a typical use of TReCaptcha control: +

+ + +<com:TReCaptcha2 ID="Captcha" + SiteKey="..." + SecretKey="..." +/> +<com:TReCaptcha2Validator ControlToValidate="Captcha" + ErrorMessage="You are challenged!" /> + + + + +
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.page new file mode 100755 index 00000000..6a0188d6 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.page @@ -0,0 +1,17 @@ + +

TReCaptcha Samples

+ +

Validating ReCAPTCHA v1

+ +Please note that this sample can't work unless you provide a valid private/public key to use the ReCAPTCHA service. + + + + + + +
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.php new file mode 100755 index 00000000..d99d2df2 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha/Home.php @@ -0,0 +1,11 @@ +IsValid) + $sender->Text="You passed!"; + } +} + diff --git a/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.page new file mode 100755 index 00000000..742fe496 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.page @@ -0,0 +1,17 @@ + +

TReCaptcha Samples

+ +

Validating ReCAPTCHA v2

+ +Please note that this sample can't work unless you provide a valid private/public key to use the ReCAPTCHA service. + + + + + + +
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.php new file mode 100755 index 00000000..aedbb7dc --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TReCaptcha2/Home.php @@ -0,0 +1,11 @@ +IsValid) + $sender->Text="You passed!"; + } +} + diff --git a/demos/quickstart/protected/pages/Controls/Standard.page b/demos/quickstart/protected/pages/Controls/Standard.page index 43fecfb3..508442ed 100755 --- a/demos/quickstart/protected/pages/Controls/Standard.page +++ b/demos/quickstart/protected/pages/Controls/Standard.page @@ -133,6 +133,14 @@ TRadioButton represents a radiobutton on a Web page. It is mainly used in a group from which users make a choice. +
  • + TReCaptcha displays a ReCaptcha v1 useful to detect if the user is a bot or an human. +
  • + +
  • + TReCaptcha2 displays a ReCaptcha v2 useful to detect if the user is a bot or an human. +
  • +
  • TSafeHtml displays its body content with assurance that the content contain no harmful code (such as XSS).
  • -- cgit v1.2.3