From ffdffb3e1a7711c962ddbb233b84063abc407de6 Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 29 Aug 2007 03:14:14 +0000 Subject: fixed a small bug. --- HISTORY | 1 + demos/helloworld/protected/pages/Home.page | 5 +++-- demos/helloworld/protected/pages/Home.php | 11 ++++++++++- framework/Web/UI/WebControls/TCaptcha.php | 3 --- 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 @@ - + + - + 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)setViewState('PublicKey',$value,''); } -- cgit v1.2.3