summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/templates/login.php1
-rw-r--r--index.php2
-rw-r--r--lib/helper.php2
-rw-r--r--lib/util.php6
4 files changed, 8 insertions, 3 deletions
diff --git a/core/templates/login.php b/core/templates/login.php
index aff0afac203..6c0a7a12227 100644
--- a/core/templates/login.php
+++ b/core/templates/login.php
@@ -1,5 +1,6 @@
<form action="index.php" method="post">
<fieldset>
+ <?php if(!empty($_['redirect'])) { echo '<input type="hidden" name="redirect_url" value="'.$_['redirect'].'" />'; } ?>
<?php if($_['error']): ?>
<a href="./core/lostpassword/"><?php echo $l->t('Lost your password?'); ?></a>
<?php endif; ?>
diff --git a/index.php b/index.php
index fb8d1922dd4..d2d0700c577 100644
--- a/index.php
+++ b/index.php
@@ -90,5 +90,5 @@ else {
}
}
- OC_Template::printGuestPage('', 'login', array('error' => $error ));
+ OC_Template::printGuestPage('', 'login', array('error' => $error, 'redirect' => isset($_REQUEST['redirect_url'])?$_REQUEST['redirect_url']:'' ));
}
diff --git a/lib/helper.php b/lib/helper.php
index b6332b54aea..9c2b5fc33ce 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -61,7 +61,7 @@ class OC_Helper {
}
if($redirect_url)
- return $urlLinkTo.'?redirect_url='.$redirect_url;
+ return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]);
else
return $urlLinkTo;
diff --git a/lib/util.php b/lib/util.php
index 5d03c56f18e..f8748e868c1 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -321,7 +321,11 @@ class OC_Util {
* Redirect to the user default page
*/
public static function redirectToDefaultPage(){
- header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', 'files/index.php'));
+ if(isset($_REQUEST['redirect_url'])) {
+ header( 'Location: '.$_REQUEST['redirect_url']);
+ } else {
+ header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', 'files/index.php'));
+ }
exit();
}
}