fixed a bug in the path calculation to send the user back to where s/he came from (#1138)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6594 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-01-12 02:39:12 +00:00
1 parent fdc824ac5e
commit cddeb23d2c
1 file changed
+9 -5
@@ -1,9 +1,12 @@
package hudson.security;
import org.acegisecurity.ui.webapp.AuthenticationProcessingFilter;
import org.kohsuke.stapler.Stapler;
import javax.servlet.http.HttpServletRequest;
import hudson.model.Hudson;
/**
* {@link AuthenticationProcessingFilter} with a change for Hudson so that
* we can pick up the hidden "from" form field defined in <tt>login.jelly</tt>
@@ -16,11 +19,12 @@ public class AuthenticationProcessingFilter2 extends AuthenticationProcessingFil
protected String determineTargetUrl(HttpServletRequest request) {
String targetUrl = request.getParameter("from");
if (targetUrl == null) {
targetUrl = getDefaultTargetUrl();
}
return targetUrl;
if (targetUrl == null)
return getDefaultTargetUrl();
else
// URL returned from determineTargetUrl() is resolved against the context path,
// whereas the "from" URL is resolved against the top of the website, so adjust this.
return targetUrl.substring(request.getContextPath().length());
}
}