Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c72db14b authored by Alexandre Roux's avatar Alexandre Roux
Browse files

back to single file patch + comment within patch + move logic to OC_template instead of error page

parent 43ce78c1
Loading
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -220,8 +220,7 @@ RUN patch -u ${BASE_DIR}/apps/dav/lib/Connector/Sabre/Principal.php -i ${TMP_PAT
RUN patch -u ${BASE_DIR}/apps/dav/lib/HookManager.php -i ${TMP_PATCH_DIR}/028-default-task-calendar.patch
RUN patch -u ${BASE_DIR}/apps/provisioning_api/lib/Controller/UsersController.php -i ${TMP_PATCH_DIR}/029-restrict-user-to-change-primary-email.patch
RUN patch -u ${BASE_DIR}/lib/private/Security/VerificationToken/VerificationToken.php -i ${TMP_PATCH_DIR}/033-verification-token-private.patch
RUN patch -u ${BASE_DIR}/core/templates/error.php -i ${TMP_PATCH_DIR}/034-display-back-to-login-error-page.patch
RUN patch -u ${BASE_DIR}/lib/private/legacy/OC_Template.php -i ${TMP_PATCH_DIR}/035-display-back-to-login-oc_template.patch
RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/035-display-back-to-login.patch
RUN rm -rf ${TMP_PATCH_DIR}

RUN curl -fsSL -o ldap_write_support.tar.gz \
+0 −21
Original line number Diff line number Diff line
diff --git a/core/templates/error.php b/core/templates/error.php
index 2e5488ae8d..d39dc8580b 100644
--- ./core/templates/error.php
+++ ./core/templates/error-new.php
@@ -1,4 +1,5 @@
 <div class="guest-box">
+	<?php $displayBackToLogin = false; ?>
 	<h2><?php p($l->t('Error')) ?></h2>
 	<ul>
 	<?php foreach ($_["errors"] as $error):?>
@@ -8,6 +9,10 @@
 				<p class='hint'><?php p($error['hint']) ?></p>
 			<?php endif;?>
 		</li>
+		<?php if ($error['statusCode'] == 401) $displayBackToLogin = true; ?>
 	<?php endforeach ?>
 	</ul>
+	<?php if ($displayBackToLogin): ?>
+		<a  href="<?php print_unescaped($_['logout_url']); ?>"><?php p($l->t('Back to login')) ?></a>
+	<?php endif; ?>
 </div>
+36 −0
Original line number Diff line number Diff line
Subject: [PATCH] This patch display a back to login link in error page when encountering a 401 HTTP Error code

diff --git a/core/templates/error.php b/core/templates/error.php
index 2e5488ae8d..72c58e3bcf 100644
--- core/templates/error.php
+++ core/templates/error.php
@@ -10,4 +10,7 @@
 		</li>
 	<?php endforeach ?>
 	</ul>
+	<?php if (isset($_['logout_url'])): ?>
+		<a  href="<?php print_unescaped($_['logout_url']); ?>"><?php p($l->t('Back to login')) ?></a>
+	<?php endif; ?>
 </div>
diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php
index 0c9fa1ccc0..7f58c6d007 100644
--- ./lib/private/legacy/OC_Template.php
+++ ./lib/private/legacy/OC_Template-new.php
index 0c9fa1ccc0..6792f2268e 100644
--- lib/private/legacy/OC_Template.php
+++ lib/private/legacy/OC_Template.php
@@ -279,7 +279,7 @@ class OC_Template extends \OC\Template\Base {
 	 * @param int $statusCode
 	 * @suppress PhanAccessMethodInternal
@@ -11,13 +25,11 @@ index 0c9fa1ccc0..7f58c6d007 100644
 		if (\OC::$server->getAppManager()->isEnabledForUser('theming') && !\OC_App::isAppLoaded('theming')) {
 			\OC_App::loadApp('theming');
 		}
@@ -293,8 +293,9 @@ class OC_Template extends \OC\Template\Base {
 		http_response_code($statusCode);
 		try {
@@ -295,6 +295,8 @@ class OC_Template extends \OC\Template\Base {
 			$content = new \OC_Template('', 'error', 'error', false);
-			$errors = [['error' => $error_msg, 'hint' => $hint]];
+			$errors = [['error' => $error_msg, 'hint' => $hint, 'statusCode' => $statusCode]];
 			$errors = [['error' => $error_msg, 'hint' => $hint]];
 			$content->assign('errors', $errors);
+			if($statusCode === 401)
+				$content->assign('logout_url', $logoutUrl != null ? $logoutUrl : OC_User::getLogoutUrl(\OC::$server->getURLGenerator()));
 			$content->printPage();
 		} catch (\Exception $e) {