Skip to content

Commit

Permalink
oauth login pass returnto parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Mar 8, 2024
1 parent e551a66 commit a2b8ef3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public function register()
}
});
$this->renderable(function (PassportAuthenticationException $e) {
return response()->redirectTo(getSchemeAndHttpHost() . "/login.php");
$request = request();
return response()->redirectTo(sprintf("%s/login.php?returnto=%s", $request->getSchemeAndHttpHost(), urlencode($request->fullUrl())));
});

//Other Only handle in json request
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Authenticate extends Middleware
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return getBaseUrl() . '/login.php';
return sprintf("%s/login.php?returnto=%s", $request->getSchemeAndHttpHost(), urlencode($request->fullUrl()));
}
}
}
2 changes: 1 addition & 1 deletion app/Http/Middleware/NexusAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NexusAuth extends Middleware
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return getBaseUrl() . '/login.php';
return sprintf("%s/login.php?returnto=%s", $request->getSchemeAndHttpHost(), urlencode($request->fullUrl()));
}
}
}

0 comments on commit a2b8ef3

Please sign in to comment.