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

75488: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (5.0/Cloud)
      74477: Merged DEV to V4.2-BUG-FIX (4.2.3).
         73923: MNT-11654: Manage System Users: Email domain, which contains underscore, is not valid.
         73998: MNT-11654: Manage System Users: Email domain, which contains underscore, is not valid.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77450 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-22 12:25:22 +00:00
parent 2b516ac5a8
commit d619e3cf22
2 changed files with 13 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.regex.Pattern;
import javax.faces.application.FacesMessage; import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent; import javax.faces.component.UIComponent;
@@ -123,7 +124,6 @@ public class CreateUserWizard extends BaseWizardBean
/** ref to the default home location */ /** ref to the default home location */
private NodeRef defaultHomeSpaceRef; private NodeRef defaultHomeSpaceRef;
/** /**
* @param authenticationService The AuthenticationService to set. * @param authenticationService The AuthenticationService to set.
*/ */
@@ -633,8 +633,9 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
public void validateEmail(FacesContext context, UIComponent component, Object value) throws ValidatorException public void validateEmail(FacesContext context, UIComponent component, Object value) throws ValidatorException
{ {
EmailValidator emailValidator = EmailValidator.getInstance(); String emailRegExp = Application.getClientConfig(context).getEmailRegExp();
if (!emailValidator.isValid((String) value)) Pattern pattern = Pattern.compile(emailRegExp, Pattern.CASE_INSENSITIVE);
if (!pattern.matcher((CharSequence) value).matches())
{ {
String err = Application.getMessage(context, MSG_ERROR_MAIL_NOT_VALID); String err = Application.getMessage(context, MSG_ERROR_MAIL_NOT_VALID);
throw new ValidatorException(new FacesMessage(err)); throw new ValidatorException(new FacesMessage(err));

View File

@@ -87,7 +87,7 @@ public class ClientConfigElement extends ConfigElementAdapter
private boolean checkContextAgainstPath = false; private boolean checkContextAgainstPath = false;
private boolean allowUserScriptExecute = false; private boolean allowUserScriptExecute = false;
private boolean isBulkFetchEnabled = true; private boolean isBulkFetchEnabled = true;
private String emailRegExp = "^([-A-Za-z0-9\\xc0-\\xff!#$%&'*+\\/=?^_`{}~|]+\\.)*[-A-Za-z0-9\\xc0-\\xff!#$%&'*+\\/=?^_`{}|~_]+@([\\.A-Za-z0-9_-])*[A-Za-z0-9_-]$";
/** /**
* Default Constructor * Default Constructor
@@ -981,4 +981,12 @@ public class ClientConfigElement extends ConfigElementAdapter
this.isBulkFetchEnabled = isBulkFetchEnabled; this.isBulkFetchEnabled = isBulkFetchEnabled;
} }
/**
* @return regexp for email validation
*/
public String getEmailRegExp()
{
return emailRegExp;
}
} }