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.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.routines.EmailValidator;
/** /**
* @author Kevin Roast * @author Kevin Roast
@@ -73,6 +74,7 @@ public class CreateUserWizard extends BaseWizardBean
protected static final String ERROR_DOMAIN_MISMATCH = "error_domain_mismatch"; 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_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_KB = "kilobyte";
protected static final String QUOTA_UNITS_MB = "megabyte"; 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 // Helper methods

View File

@@ -61,7 +61,7 @@
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" /> <h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.email}"/> <h:outputText value="#{msg.email}"/>
<h:inputText id="email" value="#{WizardManager.bean.email}" disabled="#{WizardManager.bean.personPropertiesImmutability.email == true}" size="35" maxlength="1024" onkeyup="updateButtonState();" onchange="updateButtonState();" /> <h:inputText id="email" value="#{WizardManager.bean.email}" validator="#{WizardManager.bean.validateEmail}" disabled="#{WizardManager.bean.personPropertiesImmutability.email == true}" size="35" maxlength="1024" onkeyup="updateButtonState();" onchange="updateButtonState();" />
</h:panelGrid> </h:panelGrid>
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;" <h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;"