Merged BRANCHES/DEV/V4.1-BUG-FIX to HEAD

41929: ALF-12202: Solr Port display wrong labels on Edit form
          - Added solr.help.field.solr.port and solr.help.field.solr.port.ssl messages
   41940: Fix for ALF-16086 SOLR tracking does not include transformation status etc (error in header name)
   41958: Merged V4.1 to V4.1-BUG-FIX (RECORD ONLY)
            39973: Merged BRANCHES/DEV/V4.1-BUG-FIX to BRANCHES/V4.1: merged for KR => ALF-13404 (and CLOUD-438)
               39953: Refactored "Content I'm Editing" dashlet from synchronous (slowing down user dashboard initial display) to asynchronous client-side rendering.
            39976: Merged BRANCHES/DEV/V4.1-BUG-FIX to BRANCHES/DEV/V3.4-BUG-FIX: (record-only) - for KR (to ignore the hand merge of the dashlet changes from V3.4)
               39953: Refactored "Content I'm Editing" dashlet from synchronous (slowing down user dashboard initial display) to asynchronous client-side rendering. (ALF-13404)
            41129: ALF-15782: Merged V4.1-BUG-FIX to V4.1
               41032: Fix for ALF-15753	Infinite loop during Solr ACL indexing when ACL Changeset batch is empty
   41986: Merged PATCHES/V4.1.1 to V4.1-BUG-FIX
            41983: Merged V4.1 to PATCHES/V4.1.1
               41982: Merged DEV to V4.1
                  41962: ALF-16029: TransactionCleanupTest throws constraint violations
                     Use overrided deleteNodesByCommitTime() method in DAO for MSSQL. 
                  41977: ALF-16029: TransactionCleanupTest throws constraint violations.
                     Change delete_NodePropsByTxnCommitTime statement to be common for all DB dialects.
            41985: Merged V4.1 to PATCHES/V4.1.1 (RECORD ONLY)
               41129: ALF-15782: Merged V4.1-BUG-FIX to V4.1
                  41032: Fix for ALF-15753	Infinite loop during Solr ACL indexing when ACL Changeset batch is empty
               41654: Fix for ALF-15965 - hand merged back from rev 41653
               41968: Merged PATCHES/V4.1.1 to V4.1 (4.1.1)
   42045: Refactor of recent change to always release opLock on close.   Code needs to move out of the transactional layers to LegacyFileStateDriver.
   42052: Fix for ALF-952
          Merged BRANCHES/DEV to BRANCHES/DEV/V4.1-BUG-FIX
             41829: akovalchuk ALF-952: Message "Password must be between 3 and 256 characters in length" incorrect
                Configuration of max password length is now being picked up from ClientConfig (which reads it from password-max-length element of web-client-config.xml) and validated on backend using LoginBean.validatePassword method.
                Maximum password length is set to 255. Field "confirm" is checked only for exact matching to the field "password" at validation phase using LoginBean.validateMatch.
                Tenant username check now is made at validation phase together with other username validations in CreateUserWizard.validateUsername.
   42056: Merged HEAD to V4.1-BUG-FIX (RECORD ONLY)
            ALF-15987: merged Visio support in HEAD to V4.1-BUG-FIX.
   42111: SPANISH: Translation updates based on EN r41902, Fixes: ALF-15359, ALF-15682, ALF-15926
   42112: ITALIAN: Translation updates based on EN r41902, Fixes: ALF-15359, ALF-15682, ALF-15926
   42113: JAPANESE: Translation updates based on EN r41902, Fixes: ALF-15359, ALF-15682, ALF-15926
   42115: ALL LANGUAGES: Standardises on 24 hour display for all non-English languages. Fixes: ALF-15992 and related to ALF-13712
   42129: ALF-16098: Activiti upgrade to 5.10 (RECORD ONLY)
   42136: Last SOLR side update for ALF-14861 SOLR to scale for non-admin users in 100k sites and a subgroup of each of 1000 independent groupings with 1000 subgroups
   42137: ALF-16132 - Problems with Versionable onUpdate Policy execution and JLan exception handling
          fixed third sub issue.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42145 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2012-09-28 13:18:09 +00:00
parent 9bbb1d8144
commit 27965aa47f
8 changed files with 94 additions and 38 deletions

View File

@@ -93,6 +93,9 @@
<username-min-length>2</username-min-length>
<password-min-length>3</password-min-length>
<!-- maximum length for password -->
<password-max-length>255</password-max-length>
<!-- minimum length for group name -->
<group-name-min-length>3</group-name-min-length>

View File

@@ -27,6 +27,7 @@ import java.util.Map;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
@@ -44,6 +45,7 @@ import org.alfresco.web.app.servlet.AuthenticationHelper;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.bean.users.UserPreferencesBean;
import org.alfresco.web.bean.users.UsersDialog;
import org.alfresco.web.ui.common.PanelGenerator;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
@@ -262,6 +264,29 @@ public class LoginBean implements Serializable
// ------------------------------------------------------------------------------
// Validator methods
/**
* Validate that field "confirm" matches to the field "password"
*/
public void validateMatch(FacesContext context, UIComponent component, Object value)
throws ValidatorException
{
String confirm = (String)value;
String field1Id = (String) component.getAttributes().get("passwd1Id");
UIInput passComponent = (UIInput) context.getViewRoot().findComponent(field1Id);
String pass = (String) passComponent.getSubmittedValue();
if (pass == null)
{
pass = (String) passComponent.getValue();
}
if (!pass.equals(confirm))
{
String err = Application.getMessage(context, UsersDialog.ERROR_PASSWORD_MATCH);
throw new ValidatorException(new FacesMessage(err));
}
}
/**
* Validate password field data is acceptable
*/
@@ -269,12 +294,13 @@ public class LoginBean implements Serializable
throws ValidatorException
{
int minPasswordLength = Application.getClientConfig(context).getMinPasswordLength();
int maxPasswordLength = Application.getClientConfig(context).getMaxPasswordLength();
String pass = (String)value;
if (pass.length() < minPasswordLength || pass.length() > 256)
if (pass.length() < minPasswordLength || pass.length() > maxPasswordLength)
{
String err = MessageFormat.format(Application.getMessage(context, MSG_PASSWORD_LENGTH),
new Object[]{minPasswordLength, 256});
new Object[]{minPasswordLength, maxPasswordLength});
throw new ValidatorException(new FacesMessage(err));
}
}

View File

@@ -270,31 +270,6 @@ public class CreateUserWizard extends BaseWizardBean
this.sizeQuotaUnits = "";
}
@Override
public String next()
{
String stepName = Application.getWizardManager().getCurrentStepName();
if ("summary".equals(stepName))
{
FacesContext context = FacesContext.getCurrentInstance();
if (! this.password.equals(this.confirm))
{
Utils.addErrorMessage(Application.getMessage(context, UsersDialog.ERROR_PASSWORD_MATCH));
}
checkTenantUserName();
if (context.getMessages().hasNext())
{
Application.getWizardManager().getState().setCurrentStep(Application.getWizardManager().getCurrentStep() - 1);
}
}
return super.next();
}
/**
* @return Returns the summary data for the wizard.
*/
@@ -594,16 +569,19 @@ public class CreateUserWizard extends BaseWizardBean
/**
* Validate password field data is acceptable
*
* @deprecated Method is never used
*/
public void validatePassword(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
int minPasswordLength = Application.getClientConfig(context).getMinPasswordLength();
int maxPasswordLength = Application.getClientConfig(context).getMaxPasswordLength();
String pass = (String)value;
if (pass.length() < minPasswordLength || pass.length() > 256)
if (pass.length() < minPasswordLength || pass.length() > maxPasswordLength)
{
String err = MessageFormat.format(Application.getMessage(context, LoginBean.MSG_PASSWORD_LENGTH),
new Object[]{minPasswordLength, 256});
new Object[]{minPasswordLength, maxPasswordLength});
throw new ValidatorException(new FacesMessage(err));
}
}
@@ -628,6 +606,19 @@ public class CreateUserWizard extends BaseWizardBean
new Object[]{"\", \\"});
throw new ValidatorException(new FacesMessage(err));
}
try
{
name = PersonServiceImpl.updateUsernameForTenancy(
name, getTenantService()
);
}
catch(TenantDomainMismatchException e)
{
String err = MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(),
ERROR_DOMAIN_MISMATCH), e.getTenantA(), e.getTenantB());
throw new ValidatorException(new FacesMessage(err));
}
}
// ------------------------------------------------------------------------------

View File

@@ -75,6 +75,7 @@ public class ClientConfigElement extends ConfigElementAdapter
private List<QName> simpleSearchAdditionalAttributes = null;
private int minUsernameLength = 2;
private int minPasswordLength = 3;
private int maxPasswordLength = 255;
private int minGroupNameLength = 3;
private String breadcrumbMode = BREADCRUMB_PATH;
private String cifsURLSuffix = null;
@@ -280,6 +281,11 @@ public class ClientConfigElement extends ConfigElementAdapter
combinedElement.setMinPasswordLength(newElement.getMinPasswordLength());
}
if (newElement.getMaxPasswordLength() != combinedElement.getMaxPasswordLength())
{
combinedElement.setMaxPasswordLength(newElement.getMaxPasswordLength());
}
if (newElement.getMinGroupNameLength() != combinedElement.getMinGroupNameLength())
{
combinedElement.setMinGroupNameLength(newElement.getMinGroupNameLength());
@@ -769,6 +775,22 @@ public class ClientConfigElement extends ConfigElementAdapter
this.minPasswordLength = minPasswordLength;
}
/**
* @return Returns the maximum length for a password.
*/
public int getMaxPasswordLength()
{
return this.maxPasswordLength;
}
/**
* @param maxPasswordLength The maximum length of a password
*/
public void setMaxPasswordLength(int maxPasswordLength)
{
this.maxPasswordLength = maxPasswordLength;
}
/**
* @return Returns the minimum length for a group name.
*/

View File

@@ -59,6 +59,7 @@ public class ClientElementReader implements ConfigElementReader
public static final String ELEMENT_SIMPLESEARCHADDITIONALATTRSQNAME = "qname";
public static final String ELEMENT_MINUSERNAMELENGTH = "username-min-length";
public static final String ELEMENT_MINPASSWORDLENGTH = "password-min-length";
public static final String ELEMENT_MAXPASSWORDLENGTH = "password-max-length";
public static final String ELEMENT_MINGROUPNAMELENGTH = "group-name-min-length";
public static final String ELEMENT_BREADCRUMB_MODE = "breadcrumb-mode";
public static final String ELEMENT_CIFSURLSUFFIX = "cifs-url-suffix";
@@ -268,6 +269,13 @@ public class ClientElementReader implements ConfigElementReader
configElement.setMinPasswordLength(Integer.parseInt(minPassword.getTextTrim()));
}
// get the maximum length of passwords
Element maxPassword = element.element(ELEMENT_MAXPASSWORDLENGTH);
if (maxPassword != null)
{
configElement.setMaxPasswordLength(Integer.parseInt(maxPassword.getTextTrim()));
}
// get the minimum length of group names
Element minGroupName = element.element(ELEMENT_MINGROUPNAMELENGTH);
if (minGroupName != null)

View File

@@ -79,15 +79,17 @@
<tr>
<td></f:verbatim><h:outputText value="#{msg.new_password}" /><f:verbatim>:</td>
<td></f:verbatim><h:inputSecret id="password" value="#{UsersBeanProperties.password}"
size="35" maxlength="255" validator="#{LoginBean.validatePassword}"
size="35" validator="#{LoginBean.validatePassword}"
onkeyup="updateButtonState();" onchange="updateButtonState();" /><f:verbatim>&nbsp;*
&nbsp;</f:verbatim><h:message id="errors1" for="password" style="color:red" /><f:verbatim></td>
</tr>
<tr>
<td></f:verbatim><h:outputText value="#{msg.confirm}" /><f:verbatim>:</td>
<td></f:verbatim><h:inputSecret id="confirm" value="#{UsersBeanProperties.confirm}"
size="35" maxlength="255" validator="#{LoginBean.validatePassword}"
onkeyup="updateButtonState();" onchange="updateButtonState();" /><f:verbatim>&nbsp;*
size="35" validator="#{LoginBean.validateMatch}"
onkeyup="updateButtonState();" onchange="updateButtonState();">
<f:attribute name="passwd1Id" value="dialog:dialog-body:password" />
</h:inputSecret><f:verbatim>&nbsp;*
&nbsp;</f:verbatim><h:message id="errors2" for="confirm" style="color:red" /><f:verbatim></td>
</tr>
</table>

View File

@@ -63,7 +63,7 @@
<td>
</f:verbatim>
<h:inputSecret id="password" value="#{UsersBeanProperties.password}"
size="35" maxlength="255" validator="#{LoginBean.validatePassword}"
size="35" validator="#{LoginBean.validatePassword}"
onkeyup="updateButtonState();" onchange="updateButtonState();" /><f:verbatim>&nbsp;*
&nbsp;</f:verbatim><h:message id="errors1" for="password" style="color:red" /><f:verbatim></td>
</tr>
@@ -72,8 +72,10 @@
<td>
</f:verbatim>
<h:inputSecret id="confirm" value="#{UsersBeanProperties.confirm}"
size="35" maxlength="255" validator="#{LoginBean.validatePassword}"
onkeyup="updateButtonState();" onchange="updateButtonState();" /><f:verbatim>&nbsp;*
size="35" validator="#{LoginBean.validateMatch}"
onkeyup="updateButtonState();" onchange="updateButtonState();" >
<f:attribute name="passwd1Id" value="dialog:dialog-body:password" />
</h:inputSecret><f:verbatim>&nbsp;*
&nbsp;</f:verbatim><h:message id="errors2" for="confirm" style="color:red" /><f:verbatim></td>
</tr>
</table>

View File

@@ -98,17 +98,19 @@ function validate()
<h:panelGrid columns="4" cellpadding="2" cellspacing="2" width="100%">
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.username}:"/>
<h:inputText id="userName" value="#{WizardManager.bean.userName}" size="35" maxlength="100" validator="#{LoginBean.validateUsername}" onkeyup="updateButtonState();" onchange="updateButtonState();"/>
<h:inputText id="userName" value="#{WizardManager.bean.userName}" size="35" maxlength="100" validator="#{WizardManager.bean.validateUsername}" onkeyup="updateButtonState();" onchange="updateButtonState();"/>
<h:message id="errors1" for="userName" style="color:red" />
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.password}:"/>
<h:inputSecret id="password" value="#{WizardManager.bean.password}" size="35" maxlength="100" validator="#{LoginBean.validatePassword}" onkeyup="updateButtonState();" onchange="updateButtonState();" redisplay="true" />
<h:inputSecret id="password" value="#{WizardManager.bean.password}" size="35" validator="#{LoginBean.validatePassword}" onkeyup="updateButtonState();" onchange="updateButtonState();" redisplay="true" />
<h:message id="errors2" for="password" style="color:red" />
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.confirm}:"/>
<h:inputSecret id="confirm" value="#{WizardManager.bean.confirm}" size="35" maxlength="100" validator="#{LoginBean.validatePassword}" onkeyup="updateButtonState();" onchange="updateButtonState();" redisplay="true" />
<h:inputSecret id="confirm" value="#{WizardManager.bean.confirm}" size="35" validator="#{LoginBean.validateMatch}" onkeyup="updateButtonState();" onchange="updateButtonState();" redisplay="true">
<f:attribute name="passwd1Id" value="wizard:wizard-body:password" />
</h:inputSecret>
<h:message id="errors3" for="confirm" style="color:red" />
</h:panelGrid>