1,话不多说贴代码:
 

  1.  function actionLogin(){   
  2.         if ($this->context->isPOST()){   
  3.                 
  4.           $username = $this->context->username;   
  5.           $password = $this->context->password;   
  6.           do {   
  7.                  
  8.             if (!$this->imgcode->check($this->context->verifycode)){   
  9.                 $this->app->setFlashMessage('验证码错误或已过期');   
  10.                 break;   
  11.             }   
  12.                 $user = User::meta()->validateLogin($username$password);   
  13.             /* @var $user User */  
  14.            if ($user->id()){   
  15.                 $this->app->setUser($user->getAclData(), $user->getAclRoles());   
  16.                 return $this->_redirect($this->_url('List'));   
  17.             }   
  18.            $this->app->setFlashMessage('用户名、密码错误或帐户被锁定');   
  19.              
  20.           } while (false);   
  21.         }   
  22.         return $this->_redirect($this->_url('index'));       
  23.            
  24.  }   

2,注销代码 3,验证码代码

  1.  function actionLogout(){   
  2.                $this->app->cleanUser();   
  3.          return $this->_redirect($this->context->url());   
  4.                
  5.      }  

 

  1.  function actionImgCode(){   
  2.          return $this->imgcode->make();   
  3.      }  

© 2008 - 2010, Zeroun's Blog -- 黄志勇的博客!. 版权所有.

作者:
该日志由 admin 于2008年10月20日发表在PHP分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。 | +复制链接
转载请注明: QeePHP登陆验证实例分享
关键字: , , ,
【上一篇】
【下一篇】

您可能感兴趣的文章:

发表评论

[请申请gravatar头像,木有头像的评论可能不会被回复|头像相关帮助]

插入图片