From: Luka Trovic Date: Mon, 11 Sep 2023 16:22:07 +0000 (+0200) Subject: feat: update sign up link in share pages X-Git-Tag: v28.0.0rc1~38^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b134e1cbc754dcfa8ad5359009974659c27f7f79;p=nextcloud-server.git feat: update sign up link in share pages Signed-off-by: Luka Trovic --- diff --git a/core/templates/layout.public.php b/core/templates/layout.public.php index 8ebbef828b4..cd26fcba6de 100644 --- a/core/templates/layout.public.php +++ b/core/templates/layout.public.php @@ -110,7 +110,7 @@ if (isset($template) && $template->getActionCount() !== 0) { if ($_['showSimpleSignUpLink']) { ?>

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

diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 011597e6c29..2adf3c5e692 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -47,11 +47,13 @@ use OC\Search\SearchQuery; 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; @@ -206,7 +208,21 @@ class TemplateLayout extends \OC_Template { if ($showSimpleSignup && $subscription->delegateHasValidSubscription()) { $showSimpleSignup = false; } + + $defaultSignUpLink = 'https://nextcloud.com/signup/'; + $signUpLink = $this->config->getSystemValueString('registration_link', $defaultSignUpLink); + if ($signUpLink !== $defaultSignUpLink) { + $showSimpleSignup = true; + } + + $appManager = \OCP\Server::get(IAppManager::class); + if ($appManager->isEnabledForUser('registration')) { + $urlGenerator = \OCP\Server::get(IURLGenerator::class); + $signUpLink = $urlGenerator->getAbsoluteURL('/index.php/apps/registration/'); + } + $this->assign('showSimpleSignUpLink', $showSimpleSignup); + $this->assign('signUpLink', $signUpLink); } else { parent::__construct('core', 'layout.base'); }