int loginCounter = 0;
String currentIP = request.getRemoteAddr();
ActionMessages errors = new ActionMessages();
LoginForm loginForm = (LoginForm)form;
String username = loginForm.getMemberUserName();
String password = loginForm.getMemberPassword();
MemberVO token = null;
LoginHistoryVO accessHistory = null;
ServletContext sCtx = request.getSession().getServletContext();
WebApplicationContext wCtx = WebApplicationContextUtils.getWebApplicationContext(sCtx);
MyAlumniUserContainer container = (MyAlumniUserContainer)wCtx.getBean("userContainer");
logger.info("Login attempt --> , [ " + username + " ][ " + currentIP + "]");
if (counter == null) {
session.setAttribute("loginCounter", new Integer(loginCounter));
session.setAttribute("loginUserCounter", username);
} else {
loginCounter = counter.intValue();
}
// login and store it in the session
accessHistory = createAccessHistory(request, username);
try {
token = securityService.login(username, password, currentIP);
token.setLoginSuccessfull(true);
accessHistory.setLoginStatus(BaseConstants.LOGIN_PASS);
accessHistory.setReasonCode(ReasonCodes.SUCCESS);
// Prompt user to change password
if (token.getPromptChange().equals(BaseConstants.BOOLEAN_YES)){
loginForm.setMemberUserName(token.getMemberUserName());
loginForm.setMemberPassword("");
loginForm.setMemberTempPassword("");
loginForm.setMemberPasswordConfirm("");
session.invalidate();
errors.add(BaseConstants.INFO_KEY, new ActionMessage("errors.login.resetpassword"));
saveMessages(request, errors);
accessHistory.setLoginStatus(BaseConstants.LOGIN_FAIL);