Skip to content

Commit

Permalink
移除 5.0 支持
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Sep 27, 2020
1 parent cb52f08 commit 1bc59aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"illuminate/container": "^5.1 || ^6.0 || ^7.0 || ^8.0",
"overtrue/wechat": "^4.0 || ^5.0"
"overtrue/wechat": "^4.0"
},
"require-dev": {
"laravel/framework": "^8.5",
Expand Down
10 changes: 2 additions & 8 deletions src/Middleware/OAuthAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ public function handle($request, Closure $next, $account = 'default', $scope = n
$enforceHttps = Arr::get($config, 'oauth.enforce_https', false);

if ($request->has('code')) {
if (\is_callable([$officialAccount->oauth, 'user'])) {
$user = $officialAccount->oauth->user();
} else {
$user = $officialAccount->oauth->userFromCode($request->query('code'));
}

session([$sessionKey => $user]);
session([$sessionKey => $officialAccount->oauth->user()]);

event(new WeChatUserAuthorized(session($sessionKey), true, $account));

Expand All @@ -76,7 +70,7 @@ public function handle($request, Closure $next, $account = 'default', $scope = n

// 跳转到微信授权页
return redirect()->away(
$officialAccount->oauth->scopes($scope)->redirect($this->getRedirectUrl($request, $enforceHttps))
$officialAccount->oauth->scopes($scope)->redirect($this->getRedirectUrl($request, $enforceHttps))->getTargetUrl()
);
}

Expand Down

0 comments on commit 1bc59aa

Please sign in to comment.