summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-10-05 13:06:59 +0200
committerGitHub <noreply@github.com>2021-10-05 13:06:59 +0200
commitd68f0282515cb5122cdbd834217b62079dcad9bc (patch)
tree194113d2fbaef56e5faee18fa3f64b02991e7e66 /core/Controller
parentee32c7c3282407c4cc714dc7e00a374781d9ef56 (diff)
parent1684fd0b6f9a79641f4558ad33c30b185d5d0bd0 (diff)
downloadnextcloud-server-d68f0282515cb5122cdbd834217b62079dcad9bc.tar.gz
nextcloud-server-d68f0282515cb5122cdbd834217b62079dcad9bc.zip
Merge pull request #27733 from PhrozenByte/enhancement/noid/IURLGenerator-linkToDefaultPageUrl
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/LoginController.php5
-rw-r--r--core/Controller/RecommendedAppsController.php8
-rw-r--r--core/Controller/SetupController.php8
-rw-r--r--core/Controller/TwoFactorChallengeController.php5
4 files changed, 15 insertions, 11 deletions
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index 8a96db97c9e..15ec8365c19 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -38,7 +38,6 @@ use OC\Authentication\WebAuthn\Manager as WebAuthnManager;
use OC\Security\Bruteforce\Throttler;
use OC\User\Session;
use OC_App;
-use OC_Util;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
@@ -150,7 +149,7 @@ class LoginController extends Controller {
*/
public function showLoginForm(string $user = null, string $redirect_url = null): Http\Response {
if ($this->userSession->isLoggedIn()) {
- return new RedirectResponse(OC_Util::getDefaultPageUrl());
+ return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl());
}
$loginMessages = $this->session->get('loginMessages');
@@ -274,7 +273,7 @@ class LoginController extends Controller {
return new RedirectResponse($location);
}
}
- return new RedirectResponse(OC_Util::getDefaultPageUrl());
+ return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl());
}
/**
diff --git a/core/Controller/RecommendedAppsController.php b/core/Controller/RecommendedAppsController.php
index 1b6650ed902..b38aaa31fca 100644
--- a/core/Controller/RecommendedAppsController.php
+++ b/core/Controller/RecommendedAppsController.php
@@ -30,15 +30,20 @@ use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\IInitialStateService;
use OCP\IRequest;
+use OCP\IURLGenerator;
class RecommendedAppsController extends Controller {
+ /** @var IURLGenerator */
+ public $urlGenerator;
/** @var IInitialStateService */
private $initialStateService;
public function __construct(IRequest $request,
+ IURLGenerator $urlGenerator,
IInitialStateService $initialStateService) {
parent::__construct('core', $request);
+ $this->urlGenerator = $urlGenerator;
$this->initialStateService = $initialStateService;
}
@@ -47,7 +52,8 @@ class RecommendedAppsController extends Controller {
* @return Response
*/
public function index(): Response {
- $this->initialStateService->provideInitialState('core', 'defaultPageUrl', \OC_Util::getDefaultPageUrl());
+ $defaultPageUrl = $this->urlGenerator->linkToDefaultPageUrl();
+ $this->initialStateService->provideInitialState('core', 'defaultPageUrl', $defaultPageUrl);
return new StandaloneTemplateResponse($this->appName, 'recommendedapps', [], 'guest');
}
}
diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php
index 704a2507b5a..c89709012d1 100644
--- a/core/Controller/SetupController.php
+++ b/core/Controller/SetupController.php
@@ -119,12 +119,12 @@ class SetupController {
}
if ($installRecommended) {
- $urlGenerator = \OC::$server->getURLGenerator();
- $location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended');
- header('Location: ' . $location);
+ header('Location: ' . \OC::$server->getURLGenerator()->getAbsoluteURL('index.php/core/apps/recommended'));
+ exit();
+ } else {
+ header('Location: ' . \OC::$server->getURLGenerator()->linkToDefaultPageUrl());
exit();
}
- \OC_Util::redirectToDefaultPage();
}
public function loadAutoConfig($post) {
diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php
index 30f33230d8f..8f82346c050 100644
--- a/core/Controller/TwoFactorChallengeController.php
+++ b/core/Controller/TwoFactorChallengeController.php
@@ -27,7 +27,6 @@ namespace OC\Core\Controller;
use OC\Authentication\TwoFactorAuth\Manager;
use OC_User;
-use OC_Util;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
@@ -83,7 +82,7 @@ class TwoFactorChallengeController extends Controller {
protected function getLogoutUrl() {
return OC_User::getLogoutUrl($this->urlGenerator);
}
-
+
/**
* @param IProvider[] $providers
*/
@@ -203,7 +202,7 @@ class TwoFactorChallengeController extends Controller {
if (!is_null($redirect_url)) {
return new RedirectResponse($this->urlGenerator->getAbsoluteURL(urldecode($redirect_url)));
}
- return new RedirectResponse(OC_Util::getDefaultPageUrl());
+ return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl());
}
} catch (TwoFactorException $e) {
/*