}
if (user == null)
user = retrieveMember(userId, userForm);
UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);
user.setFirstName(userForm.getFirstName());
if (userForm.getMiddleName() != null)
user.setMiddleName(userForm.getMiddleName());
user.setLastName(userForm.getLastName());
if (userForm.getDateOfBirthDate() != null)
user.setBirthday(userForm.getDateOfBirthDate());
if (userForm.getNickName() != null)
user.setNickName(userForm.getNickName());
if (userForm.getSex() != null)
user.setMale(userForm.getSex().equalsIgnoreCase("M") ? true : false);
if(UtilMethods.isSet(userForm.getChallengeQuestionId()) && UtilMethods.isInt(userForm.getChallengeQuestionId())){
userProxy.setChallengeQuestionId(userForm.getChallengeQuestionId());
}
if(UtilMethods.isSet(userForm.getChallengeQuestionAnswer())){
userProxy.setChallengeQuestionAnswer(userForm.getChallengeQuestionAnswer());
}
if (!userForm.getPrefix().equals("other"))
userProxy.setPrefix(userForm.getPrefix());
else
userProxy.setPrefix(userForm.getOtherPrefix());
userProxy.setSuffix(userForm.getSuffix());
userProxy.setTitle(userForm.getTitle());
userProxy.setCompany(companyId);
if (userForm.getSchool() != null)
userProxy.setSchool(userForm.getSchool());
if (0 < userForm.getGraduation_year())
userProxy.setGraduation_year(userForm.getGraduation_year());
// User Name and password
if (!UtilMethods.isSet(user.getEmailAddress()) || !user.getEmailAddress().equals(userForm.getEmailAddress()))
user.setEmailAddress(userForm.getEmailAddress().trim().toLowerCase());
if ((userForm.getNewPassword() != null) && (!userForm.getNewPassword().equals(""))) {
user.setPassword(PublicEncryptionFactory.digestString(userForm.getNewPassword()));
user.setPasswordEncrypted(true);
}
if (user.isNew() || userForm.getPassChanged().equals("true")) {
user.setPassword(PublicEncryptionFactory.digestString(userForm.getPassword()));
user.setPasswordEncrypted(true);
}
APILocator.getUserAPI().save(user,APILocator.getUserAPI().getSystemUser(),false);
_setRolePermission(userProxy, req);
if(!InodeUtils.isSet(userProxy.getInode()) ){
userProxy.setUserId(user.getUserId());
userProxy.setChallengeQuestionId("0");
com.dotmarketing.business.APILocator.getUserProxyAPI().saveUserProxy(userProxy,APILocator.getUserAPI().getSystemUser(), false);
} else {
com.dotmarketing.business.APILocator.getUserProxyAPI().saveUserProxy(userProxy,APILocator.getUserAPI().getSystemUser(), false);
}