From 3084e8460ac9f2523dc78754df99c218fd2b4096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=BE=E6=A0=91?= Date: Thu, 11 Apr 2019 14:31:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=A4=B1=E8=B4=A5=E4=B8=8D=E8=B7=B3=E8=BD=AC=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=92=8C=E9=AA=8C=E8=AF=81=E7=A0=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/http/middleware/YanZheng.php | 4 +--- application/login/controller/Index.php | 15 ++++++++++----- application/login/view/index/index.html | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/application/http/middleware/YanZheng.php b/application/http/middleware/YanZheng.php index d62b5887..d1fd1431 100644 --- a/application/http/middleware/YanZheng.php +++ b/application/http/middleware/YanZheng.php @@ -24,14 +24,12 @@ class YanZheng extends Controller } if( strlen($username)<1 ) { - // $this->redirect('/login',302); echo ""; } // 检验用户名或密码是否正确 $yz = action('login/index/check',['username'=>$username,'password'=>$password]); - if($yz == null){ - // $this->error('请重新登录'); + if($yz['status'] == 0){ echo ""; } diff --git a/application/login/controller/Index.php b/application/login/controller/Index.php index a3cef54a..1a5c3a0f 100644 --- a/application/login/controller/Index.php +++ b/application/login/controller/Index.php @@ -55,7 +55,7 @@ class Index extends Controller // 验证用户名和密码 $check = $this->check($data['username'],$data['password']); - if($check) + if($check['status']==1) { // 设置cookie值 @@ -80,7 +80,7 @@ class Index extends Controller $data=['msg'=>'验证成功','status'=>1]; }else{ // 提示错误信息 - $data=['msg'=>'用户名或密码错误','status'=>0]; + $data=['msg'=>$check['msg'],'status'=>0]; } return json($data); @@ -98,8 +98,11 @@ class Index extends Controller if($userinfo == null) { - // 提示错误信息 - $this->error('帐号不存在'); + // 清除session(当前作用域) + session(null); + // 验证结果; + $data=['msg'=>'用户名不存在或被禁用','status'=>0]; + return $data; } @@ -112,13 +115,15 @@ class Index extends Controller session('userid', $userinfo->id); session('username', $username); session('password', $password); + $data=['msg'=>'验证成功','status'=>1]; }else{ // 清除cookie cookie(null, 'think_'); // 清除session(当前作用域) session(null); + $data=['msg'=>'用户名或密码错误','status'=>0]; } - return $check; + return $data; } // 生成验证码 diff --git a/application/login/view/index/index.html b/application/login/view/index/index.html index 83b949f8..bde44023 100644 --- a/application/login/view/index/index.html +++ b/application/login/view/index/index.html @@ -25,11 +25,11 @@
+
+ captcha

- captcha -