From aa2bf442dcbbe3f3b2d78a9825339aa522f1535c Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Tue, 27 Dec 2011 08:04:07 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E9=AA=8C=E8=AF=81=E7=A0=81=E9=AA=8C=E8=AF=81=E6=9C=BA?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/AccountController.php | 30 ++++- .../default/views/scripts/account/login.phtml | 45 +++---- application/models/LoginForm.php | 119 ++++++++++-------- 3 files changed, 122 insertions(+), 72 deletions(-) diff --git a/application/default/controllers/AccountController.php b/application/default/controllers/AccountController.php index de20070d..a5e58a62 100755 --- a/application/default/controllers/AccountController.php +++ b/application/default/controllers/AccountController.php @@ -349,6 +349,10 @@ class AccountController extends Zend_Controller_Action $this->messenger->addMessage('登录失败,请检查您的用户名和密码。'); } else $success=true; } + else + { + $this->messenger->addMessage('登录失败,验证码错误。'); + } if(!$success) { $flashMessenger = $this->_helper->getHelper('FlashMessenger'); @@ -520,6 +524,30 @@ class AccountController extends Zend_Controller_Action } } - } + }// function fetchpwdAction() + + function validateAction(){ + + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $config = array( + 'font_size' => 12, + 'img_height' => 22, + 'word_type' => (int)2, // 1:数字 2:英文 3:单词 + 'img_width' => 56, + 'use_boder' => TRUE, + 'font_file' => Zend_Registry::get('ROOT').'data/fonts/ggbi.ttf', + 'wordlist_file' => 'words.txt', + 'filter_type' => 5 + ); + include_once('files.php'); + + if (!files::echo_validate_image($config)) + { + exit(); + } + }//function validateAction() + } diff --git a/application/default/views/scripts/account/login.phtml b/application/default/views/scripts/account/login.phtml index 67244c53..584e0e96 100755 --- a/application/default/views/scripts/account/login.phtml +++ b/application/default/views/scripts/account/login.phtml @@ -1,23 +1,24 @@ -headTitle($this->config->title->site); - $this->headTitle('User Login'); - $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/register.css'); - $this->breadcrumb('Home'); - $this->breadcrumb('User Login'); - $this->breadcrumb()->setSeparator(' > '); -?> -
-Login -form;?> -
-
-Forgot Password? Register New User -
-messages)) : ?> -
-messages as $info)echo $info; - ?> -
+headTitle($this->config->title->site); + $this->headTitle('User Login'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/register.css'); + $this->breadcrumb('Home'); + $this->breadcrumb('User Login'); + $this->breadcrumb()->setSeparator(' > '); +?> +
+Login +form;?> +
+ +
+Forgot Password? Register New User +
+messages)) : ?> +
+messages as $info)echo $info; + ?> +
\ No newline at end of file diff --git a/application/models/LoginForm.php b/application/models/LoginForm.php index 2cc73863..a878ff76 100755 --- a/application/models/LoginForm.php +++ b/application/models/LoginForm.php @@ -1,50 +1,71 @@ -setName('login'); - - $username = new Zend_Form_Element_Text('username'); - $username->setLabel('Username') - ->setRequired(true) - ->addFilter('StripTags') - ->addFilter('StringTrim') - ->addValidator('NotEmpty'); - - $password=new Zend_Form_Element_Password('password'); - $password->setLabel('Password')->setRequired(true); - - $remember=new Zend_Form_Element_Checkbox('remember'); - $remember->setLabel('Remember me'); - $id = new Zend_Form_Element_Hidden('id'); - - $submit = new Zend_Form_Element_Submit('submit'); - $submit->setLabel('Login'); - $submit->setAttrib('id', 'submitbutton'); - - $this->addElements(array($id, $username, $password, $remember, $submit)); - $this->clearDecorators(); - $this->addDecorator('FormElements') - ->addDecorator('HtmlTag', array('tag' => '