From 95031cb139506e6f1426a78f6ac4dd764a2851a4 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Tue, 7 Aug 2012 20:31:23 +0200
Subject: [PATCH] remoteStorage: Use OCP\\Util for redirecting for login and
 generating link

---
 apps/remoteStorage/auth.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/apps/remoteStorage/auth.php b/apps/remoteStorage/auth.php
index ad6382eac7..215dfa0742 100644
--- a/apps/remoteStorage/auth.php
+++ b/apps/remoteStorage/auth.php
@@ -73,9 +73,10 @@ if($userId && $appUrl && $categories) {
 		if($currUser) {
 			die('You are logged in as '.$currUser.' instead of '.htmlentities($userId));
 		} else {
-			header('Location: /?redirect_url='.urlencode('/apps/remoteStorage/auth.php'.$_SERVER['PATH_INFO'].'?'.$_SERVER['QUERY_STRING']));
+			// this will display the login page for us
+			OCP\Util::checkLoggedIn();
 		}
 	}
 } else {//params not ok
-	die('please use e.g. /?app=remoteStorage&getfile=auth.php&userid=admin&redirect_uri=http://host/path&scope=...');
+	die('please use e.g. '.OCP\Util::linkTo('remoteStorage', 'auth.php').'?userid=admin&redirect_uri=http://host/path&scope=...');
 }
-- 
GitLab