Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

67755: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud)
      66972: Merged V4.2.2 (4.2.2) to V4.2-BUG-FIX (4.2.3)
         66591: Merged DEV to 4.2.2
            66584: MNT-8444: The Email field was not checked for rightness 
               A validator for email field is added now.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@68390 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-04-30 16:04:08 +00:00
parent 77244b8528
commit 40d423fb04
2 changed files with 21 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ import org.alfresco.web.ui.common.ReportedException;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.routines.EmailValidator;
/**
* @author Kevin Roast
@@ -73,6 +74,7 @@ public class CreateUserWizard extends BaseWizardBean
protected static final String ERROR_DOMAIN_MISMATCH = "error_domain_mismatch";
private static final String MSG_ERROR_NEWUSER_HOME_SPACE = "error_newuser_home_space";
private static final String MSG_ERROR_MAIL_NOT_VALID = "email_format_is_not_valid";
protected static final String QUOTA_UNITS_KB = "kilobyte";
protected static final String QUOTA_UNITS_MB = "megabyte";
@@ -621,6 +623,24 @@ public class CreateUserWizard extends BaseWizardBean
}
}
/**
* Validate Email field data is acceptable
*
* @param context
* @param component
* @param value
* @throws ValidatorException
*/
public void validateEmail(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
EmailValidator emailValidator = EmailValidator.getInstance();
if (!emailValidator.isValid((String) value))
{
String err = Application.getMessage(context, MSG_ERROR_MAIL_NOT_VALID);
throw new ValidatorException(new FacesMessage(err));
}
}
// ------------------------------------------------------------------------------
// Helper methods