Redirect at login does work

This commit is contained in:
Michael 2021-05-11 21:04:45 +00:00
parent 43244a3588
commit f5e98c8ecf

View file

@ -36,8 +36,6 @@ class Authorize extends BaseApi
*/ */
public static function rawContent(array $parameters = []) public static function rawContent(array $parameters = [])
{ {
//return;
$response_type = !isset($_REQUEST['response_type']) ? '' : $_REQUEST['response_type']; $response_type = !isset($_REQUEST['response_type']) ? '' : $_REQUEST['response_type'];
if ($response_type != 'code') { if ($response_type != 'code') {
Logger::warning('Wrong or missing response type', ['response_type' => $response_type]); Logger::warning('Wrong or missing response type', ['response_type' => $response_type]);
@ -52,7 +50,9 @@ class Authorize extends BaseApi
$uid = local_user(); $uid = local_user();
if (empty($uid)) { if (empty($uid)) {
Logger::info('Redirect to login'); Logger::info('Redirect to login');
DI::app()->redirect('login?return_path=/oauth/authorize'); $request = $_REQUEST;
unset($request['pagename']);
DI::app()->redirect('login?return_path=/oauth/authorize' . urlencode('?' . http_build_query($request)));
} else { } else {
Logger::info('Already logged in user', ['uid' => $uid]); Logger::info('Already logged in user', ['uid' => $uid]);
} }