diff --git a/application/default/controllers/AccountController.php b/application/default/controllers/AccountController.php index 87642101..9d00f2cf 100755 --- a/application/default/controllers/AccountController.php +++ b/application/default/controllers/AccountController.php @@ -109,23 +109,20 @@ class AccountController extends Zend_Controller_Action } function loginAction() { + $form = new LoginForm(); + $success=false; + $message=''; + $this->view->form = $form; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) $this->_redirect('/account'); - - $username = $this->_request->getParam('username'); - $password = $this->_request->getParam('password'); - $vdcode = $this->_request->getParam('vdcode'); - if ($this->_request->isPost()) { - - if ($vdcode == $_SESSION['vdcodes']) { - if (!$this->login($username,$password)) + $formData = $this->_request->getPost(); + if ($form->isValid($formData)) { + if (!$this->login($formData['username'],$formData['password'])) { $this->messenger->addMessage('登录失败,请检查您的用户名和密码。'); } else $success=true; - }else{ - $this->messenger->addMessage('验证码不正确。'); - } + } if(!$success) { $flashMessenger = $this->_helper->getHelper('FlashMessenger'); diff --git a/application/default/views/scripts/account/login.phtml b/application/default/views/scripts/account/login.phtml index 5aefab2a..65e2c98e 100755 --- a/application/default/views/scripts/account/login.phtml +++ b/application/default/views/scripts/account/login.phtml @@ -1,41 +1,23 @@ -headTitle($this->config->title->site); - $this->headTitle('用户登录'); - $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/register.css'); - $this->breadcrumb('首页'); - $this->breadcrumb('用户登录'); - $this->breadcrumb()->setSeparator(' > '); -?> -