[Rt-commit] [rtir] 02/02: Don't redirect /REST/ and also handle WebPath better

Kevin Falcone falcone at bestpractical.com
Wed Oct 29 16:39:26 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/rtir-login-redirect-rest
in repository rtir.

commit fbddb6f2ead960031339fe778201a0ac4f7c0831
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Oct 29 16:06:59 2014 -0400

    Don't redirect /REST/ and also handle WebPath better
    
    /bin/rt logs in by passing user and pass in post params, so RT
    doesn't see a RedirectTo in that case, we need to be testing path_info
    to see if someone came from /NoAuth/Login.html to catch "interactive
    logins".
    
    Additionally, WebPath was not getting pushed on in the Redirect, so do
    it manually, and handle bailing out if someone has a $RedirectTo of the top
    level (which happens for any request with a $WebPath set).
    
    Fixes I#30471
---
 html/Callbacks/RTIR/autohandler/SuccessfulLogin | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/html/Callbacks/RTIR/autohandler/SuccessfulLogin b/html/Callbacks/RTIR/autohandler/SuccessfulLogin
index 9d73ac5..e580476 100644
--- a/html/Callbacks/RTIR/autohandler/SuccessfulLogin
+++ b/html/Callbacks/RTIR/autohandler/SuccessfulLogin
@@ -46,15 +46,26 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
+
+# when logging in 'normally' to an RT with a WebPath,
+# RedirectTo gets set to the WebPath
+my $webpath = RT->Config->Get('WebPath');
 if (defined $$RedirectTo &&
-    $$RedirectTo ne '/') {
+    $$RedirectTo ne '/' &&
+    $$RedirectTo !~ m{^$webpath\/?$} ) {
     return;
 }
+
+my $path = $r->path_info;
+# Mason ignores WebPath so it's always /NoAuth/Login.html, not /rt/NoAuth/Login.html
+if ($path && $path ne '/NoAuth/Login.html' ) {
+    return;
+}
+
 return unless RT->Config->Get('RTIR_RedirectOnLogin');
 
 if (RT::IR->IsStaff($session{'CurrentUser'}->Id)) {
-# no need for WebPath since Redirect() adds on the whole server URL
-    $$RedirectTo = '/RTIR/';
+    $$RedirectTo = "$webpath/RTIR/";
 }
 </%INIT>
 <%ARGS>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list