if (lh == null) {
return (mapping.findForward("dataerror"));
}
Login remote = lh.create();
remote.setDataSource(dataSource);
usrResult = remote.authenticateUser(username, password);
// Check to make sure the usrResult has all the fields we expect of it.
// if so then it was a valid login, if not, then we will fail with a general
// authentication error.
if (usrResult.containsKey("individualid") && usrResult.containsKey("firstName") && usrResult.containsKey("lastName") && usrResult.containsKey("type")) {
int individualId = Integer.parseInt((String)usrResult.get("individualid"));
userType = (String)usrResult.get("type");
String firstName = (String)usrResult.get("firstName");
String lastName = (String)usrResult.get("lastName");
if ((! userType.equalsIgnoreCase((String)daf.get("userType"))) && ! ("EMPLOYEE".equals(daf.get("userType")) && userType.equalsIgnoreCase("ADMINISTRATOR"))) {
String errorHeader = "Error occurred during login.";
errorMap.put(new Integer(0), errorHeader);
String error = "The username or password was incorrect, or the user is disabled.";
errorMap.put(new Integer(1), error);
request.setAttribute("error", errorMap);
FORWARD_final = GLOBAL_FORWARD_failure;
return (mapping.findForward(FORWARD_final));
}
userObject = remote.getUserObject(individualId, firstName, lastName, userType);
userObject.setLoginName(username);
// In a certain case we will need a blank rights matrix, so prepare the remote connection now.
AuthorizationHome ah = (AuthorizationHome)CVUtility.getHomeObject("com.centraview.administration.authorization.AuthorizationHome","Authorization");
Authorization authorizationRemote = ah.create();