Replace calls for App::redirect() with AppHelper

This commit is contained in:
Art4 2024-11-10 16:19:02 +00:00
parent 2c0db2f043
commit d87f24f17a
3 changed files with 6 additions and 6 deletions

View file

@ -26,7 +26,7 @@ class Acknowledge extends BaseApi
protected function post(array $request = [])
{
DI::session()->set('oauth_acknowledge', true);
DI::app()->redirect(DI::session()->get('return_path'));
DI::apphelper()->redirect(DI::session()->get('return_path'));
}
protected function content(array $request = []): string

View file

@ -59,14 +59,14 @@ class Authorize extends BaseApi
$uid = DI::userSession()->getLocalUserId();
if (empty($uid)) {
Logger::info('Redirect to login');
DI::app()->redirect('login?' . http_build_query(['return_authorize' => $redirect]));
DI::apphelper()->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_authorize' => $redirect, 'application' => $application['name']]));
DI::apphelper()->redirect('oauth/acknowledge?' . http_build_query(['return_authorize' => $redirect, 'application' => $application['name']]));
}
DI::session()->remove('oauth_acknowledge');
@ -77,7 +77,7 @@ class Authorize extends BaseApi
}
if ($application['redirect_uri'] != 'urn:ietf:wg:oauth:2.0:oob') {
DI::app()->redirect($request['redirect_uri'] . (strpos($request['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']]));
DI::apphelper()->redirect($request['redirect_uri'] . (strpos($request['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']]));
}
self::$oauth_code = $token['code'];

View file

@ -18,13 +18,13 @@ class RandomProfile extends BaseModule
{
protected function content(array $request = []): string
{
$a = DI::app();
$appHelper = DI::apphelper();
$contact = Contact::getRandomContact();
if (!empty($contact)) {
$link = Contact::magicLinkByContact($contact);
$a->redirect($link);
$appHelper->redirect($link);
}
DI::baseUrl()->redirect('profile');