summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-08-29 03:14:14 +0000
committerxue <>2007-08-29 03:14:14 +0000
commitffdffb3e1a7711c962ddbb233b84063abc407de6 (patch)
tree53d00781a306d5eeac2c60e5536c23ba9452e9bb
parent491d3956a4f1bc6ce5501bcc0449007a16514288 (diff)
fixed a small bug.
-rw-r--r--HISTORY1
-rw-r--r--demos/helloworld/protected/pages/Home.page5
-rw-r--r--demos/helloworld/protected/pages/Home.php11
-rw-r--r--framework/Web/UI/WebControls/TCaptcha.php3
4 files changed, 14 insertions, 6 deletions
diff --git a/HISTORY b/HISTORY
index e8f8318a..ecae1362 100644
--- a/HISTORY
+++ b/HISTORY
@@ -22,6 +22,7 @@ NEW: Ticket#676 - Added primilary Oracle support (Christophe)
NEW: Ticket#680 - Added TCacheHttpSession (Carl, Qiang)
NEW: Added TTabPanel (Qiang)
NEW: Added TKeyboard (Qiang)
+NEW: Added TCaptcha and TCaptchaValidator (Qiang)
NEW: Added Indonesian translation to QuickStart, requirements and error messages (Zaenal Mutaqin)
Version 3.1.0 July 2, 2007
diff --git a/demos/helloworld/protected/pages/Home.page b/demos/helloworld/protected/pages/Home.page
index 97702e67..0a4a36b4 100644
--- a/demos/helloworld/protected/pages/Home.page
+++ b/demos/helloworld/protected/pages/Home.page
@@ -7,9 +7,10 @@
<body>
<com:TForm>
-
+<com:TCaptcha ID="Captcha" CaseSensitive="true" MaxTokenLength="5" />
+<com:TTextBox ID="Input" />
<com:TButton Text="Click me" OnClick="buttonClicked" />
-
+<com:TCaptchaValidator EnableClientScript="true" ControlToValidate="Input" CaptchaControl="Captcha" Text="invalid" />
</com:TForm>
</body>
diff --git a/demos/helloworld/protected/pages/Home.php b/demos/helloworld/protected/pages/Home.php
index 432c2ee7..9722a782 100644
--- a/demos/helloworld/protected/pages/Home.php
+++ b/demos/helloworld/protected/pages/Home.php
@@ -2,9 +2,18 @@
class Home extends TPage
{
+ public function onPreRender($param)
+ {
+ echo "token is |".$this->Captcha->Token."|";
+ }
+
public function buttonClicked($sender,$param)
{
- $sender->Text="Hello World!";
+ if($this->Captcha->validate($this->Input->Text))
+ $sender->Text="ok";
+ else
+ $sender->Text="no!";
+ $this->Captcha->regenerateToken();
}
}
diff --git a/framework/Web/UI/WebControls/TCaptcha.php b/framework/Web/UI/WebControls/TCaptcha.php
index 921881d8..9f4cee08 100644
--- a/framework/Web/UI/WebControls/TCaptcha.php
+++ b/framework/Web/UI/WebControls/TCaptcha.php
@@ -39,7 +39,6 @@ class TCaptcha extends TImage
{
const MIN_TOKEN_LENGTH=4;
const MAX_TOKEN_LENGTH=40;
- const MIN_PUBLIC_KEY=6;
public function onInit($param)
{
@@ -121,8 +120,6 @@ class TCaptcha extends TImage
*/
public function setPublicKey($value)
{
- if(strlen($value)<self::MIN_PUBLIC_KEY)
- throw new TConfigurationException('captcha_publickey_invalid',self::MIN_PUBLIC_KEY);
$this->setViewState('PublicKey',$value,'');
}