update application/admin/controller/Index.php.

Signed-off-by: 羊小小 <8548698+yang-xiao-xiao@user.noreply.gitee.com>
pull/482/head
羊小小 2022-10-16 10:01:15 +00:00 committed by Gitee
parent d562f3d17c
commit 3d1fb04074
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 8 additions and 2 deletions

View File

@ -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);