If a user submits a login widget, it should be recognized even if they were not already known to be logging in.

This commit is contained in:
jeb228 2010-12-14 16:37:28 +00:00
parent 5d7bb84a75
commit aeac1ba058
2 changed files with 60 additions and 2 deletions

View file

@ -74,6 +74,9 @@ public class Authenticate extends VitroHttpServlet {
/** If this parameter is "true" (ignoring case), cancel the login. */
private static final String PARAMETER_CANCEL = "cancel";
/** If this parameter is set, we are not NOWHERE. */
private static final String PARAMETER_LOGIN_FORM = "loginForm";
/** Where do we find the User/Session map in the servlet context? */
public static final String USER_SESSION_MAP_ATTR = "userURISessionMap";
@ -214,9 +217,40 @@ public class Authenticate extends VitroHttpServlet {
+ "current state is NOWHERE");
}
if (weCameFromAColdWidget(request, currentState)) {
currentState = actLikeWeWereLoggingIn(request);
}
return currentState;
}
/**
* If they submitted the login form, they shouldn't be NOWHERE.
*/
private boolean weCameFromAColdWidget(HttpServletRequest request,
State currentState) {
if (currentState == NOWHERE) {
if (null != request.getParameter(PARAMETER_LOGIN_FORM)) {
return true;
}
}
return false;
}
/**
* They got here by submitting the login form. They should be treated as
* already logging in.
*/
private State actLikeWeWereLoggingIn(HttpServletRequest request) {
LoginProcessBean bean = new LoginProcessBean();
bean.setState(LOGGING_IN);
bean.setLoginPageUrl(whereDidWeComeFrom(request));
bean.setAfterLoginUrl(whereDidWeComeFrom(request));
LoginProcessBean.setBean(request, bean);
return LOGGING_IN;
}
/**
* They just got here. Start the process.
*/