}
public ActionErrors validate(ActionMapping arg0, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (!UtilMethods.isSet(password1) ){
errors.add(Globals.MESSAGES_KEY, new ActionMessage("message.contentlet.required","password"));
}
if(UtilMethods.isSet(password1) && !password1.equals(verifyPassword)){
errors.add(Globals.MESSAGES_KEY, new ActionMessage("error.passwordsDontMatch"));
}
if (!UtilMethods.isSet(emailAddress))
{
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("message.contentlet.required","eMail"));
}
if (UtilMethods.isSet(userName))
{
User user = null;
try {
user = APILocator.getUserAPI().loadByUserByEmail(userName, APILocator.getUserAPI().getSystemUser(), false);
} catch (Exception ex) {
Logger.error(this, ex.getMessage(), ex);
}
if(user != null)
{
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.inquiryUserExists"));
}
}
if (!UtilMethods.isSet(firstName))
{
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("message.contentlet.required","First Name"));
}
if (!UtilMethods.isSet(lastName))
{
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("message.contentlet.required","Last Name"));
}
if(FormSpamFilter.isSpamRequest(request)){
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("Potential Spam Message"));
}
return errors;
}