From 993d9bc9e2f036cb0818352f21fbfd37d72b69a0 Mon Sep 17 00:00:00 2001 From: Luka Trovic Date: Mon, 11 Sep 2023 18:22:07 +0200 Subject: [PATCH] feat: update sign up link in share pages Signed-off-by: Luka Trovic --- core/templates/layout.public.php | 2 +- lib/private/TemplateLayout.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/templates/layout.public.php b/core/templates/layout.public.php index e5329716cc709..5b67c9e391c1a 100644 --- a/core/templates/layout.public.php +++ b/core/templates/layout.public.php @@ -102,7 +102,7 @@ if ($_['showSimpleSignUpLink']) { ?>

- + t('Get your own free account')); ?>

diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 658a85152bf49..796dd2dc750e2 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -47,11 +47,13 @@ use OC\Template\CSSResourceLocator; use OC\Template\JSConfigHelper; use OC\Template\JSResourceLocator; +use OCP\App\IAppManager; use OCP\AppFramework\Http\TemplateResponse; use OCP\Defaults; use OCP\IConfig; use OCP\IInitialStateService; use OCP\INavigationManager; +use OCP\IURLGenerator; use OCP\IUserSession; use OCP\Support\Subscription\IRegistry; use OCP\Util; @@ -196,6 +198,14 @@ public function __construct($renderAs, $appId = '') { $showSimpleSignup = false; } $this->assign('showSimpleSignUpLink', $showSimpleSignup); + + $urlGenerator = \OCP\Server::get(IURLGenerator::class); + $signUpLink = $this->config->getSystemValueString('registration_link', $urlGenerator->getAbsoluteURL('/index.php/signup/')); + $appManager = \OCP\Server::get(IAppManager::class); + if ($appManager->isEnabledForUser('registration')) { + $signUpLink = $urlGenerator->getAbsoluteURL('/index.php/apps/registration/'); + } + $this->assign('signUpLink', $signUpLink); } else { parent::__construct('core', 'layout.base'); }