mirror of
https://github.com/friendica/friendica
synced 2025-04-22 15:10:12 +00:00
OAuth connections now have to be ackknowledged
This commit is contained in:
parent
c22846339a
commit
6ca42512e9
4 changed files with 85 additions and 7 deletions
|
@ -47,17 +47,24 @@ class Authorize extends BaseApi
|
|||
DI::mstdnError()->RecordNotFound();
|
||||
}
|
||||
|
||||
$request = $_REQUEST;
|
||||
unset($request['pagename']);
|
||||
$redirect = urlencode('oauth/authorize?' . http_build_query($request));
|
||||
|
||||
$uid = local_user();
|
||||
if (empty($uid)) {
|
||||
Logger::info('Redirect to login');
|
||||
$request = $_REQUEST;
|
||||
unset($request['pagename']);
|
||||
DI::app()->redirect('login?return_path=' . urlencode('/oauth/authorize?' . http_build_query($request)));
|
||||
DI::app()->redirect('login?return_path=' . $redirect);
|
||||
} else {
|
||||
Logger::info('Already logged in user', ['uid' => $uid]);
|
||||
}
|
||||
|
||||
$token = self::getTokenForUser($application, $uid);
|
||||
if (!self::existsTokenForUser($application, $uid) && !DI::session()->get('oauth_acknowledge')) {
|
||||
Logger::info('Redirect to acknowledge');
|
||||
DI::app()->redirect('oauth/acknowledge?return_path=' . $redirect);
|
||||
}
|
||||
|
||||
$token = self::createTokenForUser($application, $uid);
|
||||
if (!$token) {
|
||||
DI::mstdnError()->RecordNotFound();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue