NIHVIVO-151 when forcing a login, assemble the process bean and go straight to the form.
This commit is contained in:
parent
8676ec5544
commit
3c239271e3
1 changed files with 15 additions and 11 deletions
|
@ -21,8 +21,9 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LoginRedirector;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean.State;
|
||||
|
||||
public class VitroHttpServlet extends HttpServlet {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -125,16 +126,10 @@ public class VitroHttpServlet extends HttpServlet {
|
|||
*/
|
||||
public static void redirectToLoginPage(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
String postLoginRequest;
|
||||
|
||||
String queryString = request.getQueryString();
|
||||
if ((queryString == null) || queryString.isEmpty()) {
|
||||
postLoginRequest = request.getRequestURI();
|
||||
} else {
|
||||
postLoginRequest = request.getRequestURI() + "?" + queryString;
|
||||
}
|
||||
|
||||
LoginRedirector.setReturnUrlFromForcedLogin(request, postLoginRequest);
|
||||
LoginProcessBean bean = new LoginProcessBean();
|
||||
bean.setState(State.LOGGING_IN);
|
||||
bean.setAfterLoginUrl(assembleAfterLoginUrl(request));
|
||||
LoginProcessBean.setBean(request, bean);
|
||||
|
||||
String loginPage = request.getContextPath() + Controllers.LOGIN;
|
||||
|
||||
|
@ -145,6 +140,15 @@ public class VitroHttpServlet extends HttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
private static String assembleAfterLoginUrl(HttpServletRequest request) {
|
||||
String queryString = request.getQueryString();
|
||||
if ((queryString == null) || queryString.isEmpty()) {
|
||||
return request.getRequestURI();
|
||||
} else {
|
||||
return request.getRequestURI() + "?" + queryString;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If logging is set to the TRACE level, dump the HTTP headers on the request.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue