From 3d1fb040744b43840b52af9a291472b28e95a8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=8A=E5=B0=8F=E5=B0=8F?= <8548698+yang-xiao-xiao@user.noreply.gitee.com> Date: Sun, 16 Oct 2022 10:01:15 +0000 Subject: [PATCH 1/2] update application/admin/controller/Index.php. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 羊小小 <8548698+yang-xiao-xiao@user.noreply.gitee.com> --- application/admin/controller/Index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 862c2243..a0fb720c 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -15,8 +15,8 @@ use think\Validate; */ class Index extends Backend { - - protected $noNeedLogin = ['login']; + //退出登录取消登录验证 + protected $noNeedLogin = ['login', 'logout']; protected $noNeedRight = ['index', 'logout']; protected $layout = ''; @@ -124,6 +124,12 @@ class Index extends Backend */ public function logout() { + //先判断用户身份是否有效 + $res = $this->auth->getUserInfo(); + if (!$res){ + Hook::listen("admin_logout_after", $this->request); + $this->success(__('Logout successful'), 'index/login'); + } if ($this->request->isPost()) { $this->auth->logout(); Hook::listen("admin_logout_after", $this->request); From 513773801bcdac35776285b2f65f3f3ce3cf2e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BE=8A=E5=B0=8F=E5=B0=8F?= <8548698+yang-xiao-xiao@user.noreply.gitee.com> Date: Sun, 16 Oct 2022 10:04:39 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0session?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E5=90=8E=20=E9=80=80=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 羊小小 <8548698+yang-xiao-xiao@user.noreply.gitee.com> --- application/admin/controller/Index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index a0fb720c..05e918a6 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -15,7 +15,6 @@ use think\Validate; */ class Index extends Backend { - //退出登录取消登录验证 protected $noNeedLogin = ['login', 'logout']; protected $noNeedRight = ['index', 'logout']; protected $layout = '';