rundata.getParameters().getString(SecurityConstants.PARAM_ENTITY_ID));
String name = rundata.getParameters().getString("username");
if (name == null || name.trim().length() == 0)
{
DynamicURI duri = new DynamicURI (rundata);
duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_USER_UPDATE);
duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_INVALID_ENTITY_NAME);
if (user != null)
duri.addPathInfo(SecurityConstants.PARAM_ENTITY_ID, user.getUserName());
duri.addQueryData(SecurityConstants.PARAM_MODE, SecurityConstants.PARAM_MODE_UPDATE);
rundata.setRedirectURI(duri.toString());
// save values that user just entered so they don't have to re-enter
if (user != null)
rundata.getUser().setTemp(TEMP_USER, user);
return;
}
//
// pull the values off the form and into the user object
//
boolean oldDisabled = user.getDisabled();
rundata.getParameters().setProperties(user);
user.setLastAccessDate();
JetspeedSecurity.forcePassword(user,rundata.getParameters().getString("password"));
String strDisabled = rundata.getParameters().getString("disabled");
boolean disabled = (strDisabled != null);
user.setDisabled(disabled);
if (!disabled && oldDisabled && JetspeedSecurity.isDisableAccountCheckEnabled())
{
JetspeedSecurity.resetDisableAccountCheck(name);
}
//
// update the user in the database
//
JetspeedSecurity.saveUser(user);
JetspeedUser currentUser = (JetspeedUser)rundata.getUser();
if (currentUser.getUserName().equals(user.getUserName()))
{
// same user as admin -- need to update in memory
currentUser.setPassword(user.getPassword()); // Contains Encrypted password
currentUser.setFirstName(user.getFirstName());
currentUser.setLastName(user.getLastName());
currentUser.setEmail(user.getEmail());
}
}
catch (Exception e)
{
// log the error msg
logger.error("Exception", e);
//
// error on update - display error message
//
DynamicURI duri = new DynamicURI (rundata);
duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_USER_UPDATE);
duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_UPDATE_FAILED);
if (user != null)
duri.addPathInfo(SecurityConstants.PARAM_ENTITY_ID, user.getUserName());
duri.addQueryData(SecurityConstants.PARAM_MODE, SecurityConstants.PARAM_MODE_UPDATE);
rundata.setRedirectURI(duri.toString());
// save values that user just entered so they don't have to re-enter
if (user != null)
rundata.getUser().setTemp(TEMP_USER, user);
}