]> source.dussan.org Git - nextcloud-server.git/commitdiff
feat: update sign up link in share pages 40368/head
authorLuka Trovic <luka@nextcloud.com>
Mon, 11 Sep 2023 16:22:07 +0000 (18:22 +0200)
committerLuka Trovic <luka@nextcloud.com>
Tue, 21 Nov 2023 09:10:37 +0000 (10:10 +0100)
Signed-off-by: Luka Trovic <luka@nextcloud.com>
core/templates/layout.public.php
lib/private/TemplateLayout.php

index 8ebbef828b44e37b876c124f010f28bce4d9603d..cd26fcba6dec8ccbb00317144b09d06e40b92cd2 100644 (file)
@@ -110,7 +110,7 @@ if (isset($template) && $template->getActionCount() !== 0) {
 if ($_['showSimpleSignUpLink']) {
        ?>
                        <p>
-                               <a href="https://nextcloud.com/signup/" target="_blank" rel="noreferrer noopener">
+                               <a href="<?php p($_['signUpLink']); ?>" target="_blank" rel="noreferrer noopener">
                                        <?php p($l->t('Get your own free account')); ?>
                                </a>
                        </p>
index 011597e6c29c5bad352c3e899b6402272d17f481..2adf3c5e6929be7143c603439ac6a43f141fb763 100644 (file)
@@ -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');
                }