Skip to content

Commit

Permalink
修复自动登录的跳转
Browse files Browse the repository at this point in the history
  • Loading branch information
shirne committed Oct 16, 2024
1 parent 378ae6d commit 0e1f1e1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/application/index/controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ protected function checkLogin()
}
}

if ($this->wechatLogin() && $this->config['wechat_autologin'] == '1') {
if ($this->canRedirectLogin()) {
redirect()->remember();
$this->wechat = $this->getWechatAccount('wechat');
$callbackurl = url('index/login/callback', ['type' => 'wechat_' . $this->wechat['id']], true, true);
Expand All @@ -310,6 +310,20 @@ protected function checkLogin()
$this->assign('wechatUser', $this->wechatUser);
}

protected function canRedirectLogin()
{
if ($this->request->isAjax()) {
return false;
}
if (strpos($this->request->header('accept'), 'image') !== false) {
return false;
}
if ($this->wechatLogin() && $this->config['wechat_autologin'] == '1') {
return true;
}
return false;
}

/**
* 检测并自动登录微信
* @return bool
Expand Down

0 comments on commit 0e1f1e1

Please sign in to comment.