mirror of
https://github.com/friendica/friendica
synced 2024-11-17 22:23:41 +00:00
Issue 14303: Fixes %3f problem with OAuth login
This commit is contained in:
parent
26f8392754
commit
efee399397
3 changed files with 9 additions and 5 deletions
|
@ -45,7 +45,7 @@ class Acknowledge extends BaseApi
|
|||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
DI::session()->set('return_path', $_REQUEST['return_path'] ?? '');
|
||||
DI::session()->set('return_path', 'oauth/authorize?' . $request['return_authorize']);
|
||||
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('oauth_authorize.tpl'), [
|
||||
'$title' => DI::l10n()->t('Authorize application connection'),
|
||||
|
|
|
@ -68,19 +68,19 @@ class Authorize extends BaseApi
|
|||
|
||||
$redirect_request = $_REQUEST;
|
||||
unset($redirect_request['pagename']);
|
||||
$redirect = 'oauth/authorize?' . http_build_query($redirect_request);
|
||||
$redirect = http_build_query($redirect_request);
|
||||
|
||||
$uid = DI::userSession()->getLocalUserId();
|
||||
if (empty($uid)) {
|
||||
Logger::info('Redirect to login');
|
||||
DI::app()->redirect('login?return_path=' . urlencode($redirect));
|
||||
DI::app()->redirect('login?' . http_build_query(['return_authorize' => $redirect]));
|
||||
} else {
|
||||
Logger::info('Already logged in user', ['uid' => $uid]);
|
||||
}
|
||||
|
||||
if (!OAuth::existsTokenForUser($application, $uid) && !DI::session()->get('oauth_acknowledge')) {
|
||||
Logger::info('Redirect to acknowledge');
|
||||
DI::app()->redirect('oauth/acknowledge?' . http_build_query(['return_path' => $redirect, 'application' => $application['name']]));
|
||||
DI::app()->redirect('oauth/acknowledge?' . http_build_query(['return_authorize' => $redirect, 'application' => $application['name']]));
|
||||
}
|
||||
|
||||
DI::session()->remove('oauth_acknowledge');
|
||||
|
|
|
@ -60,7 +60,11 @@ class Login extends BaseModule
|
|||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
$return_path = $request['return_path'] ?? $this->session->pop('return_path', '') ;
|
||||
if (!empty($request['return_authorize'])) {
|
||||
$return_path = 'oauth/authorize?' . $request['return_authorize'];
|
||||
} else {
|
||||
$return_path = $request['return_path'] ?? $this->session->pop('return_path', '') ;
|
||||
}
|
||||
|
||||
if ($this->session->getLocalUserId()) {
|
||||
$this->baseUrl->redirect($return_path);
|
||||
|
|
Loading…
Reference in a new issue