cancel
Showing results for 
Search instead for 
Did you mean: 

Password Rule

sbeltrami
Champ in-the-making
Champ in-the-making
Is it possible to set password rule, like lenght, complexity, etc.

Thanks
5 REPLIES 5

zaizi
Champ in-the-making
Champ in-the-making
Currently you can only set the password length if you are using Alfresco for authentication. Default password length has to be between 3 and 32. You can only change the min length. You can change it in /tomcat/webapps/alfresco/WEB-INF/classes/alfresco/web-client-config.xml.

Look for the following line:

<password-min-length>3</password-min-length>

You can of course change this easily. If you set up the Alfresco SDK http://wiki.alfresco.com/wiki/Alfresco_SDK there is a example of writing your own Custom Login page (http://wiki.alfresco.com/wiki/Customising_The_Login_Page). Follow the example and override org.alfresco.web.bean.LoginBean's validatePassword method.

   public void validatePassword(FacesContext context, UIComponent component, Object value)
         throws ValidatorException
   {
      int minPasswordLength = Application.getClientConfig(context).getMinPasswordLength();
     
      String pass = (String) value;
      if (pass.length() < minPasswordLength || pass.length() > 32)
      {
         String err = MessageFormat.format(Application.getMessage(context, MSG_PASSWORD_LENGTH),
               new Object[]{minPasswordLength, 32});
         throw new ValidatorException(new FacesMessage(err));
      }
   }

sbeltrami
Champ in-the-making
Champ in-the-making
Thank You,
I try to search the code in web-client-config.xml but there is not in file.
I try to insert this code like last line but it is ignored from Alfresco.

What can I do?

Thanks

zaizi
Champ in-the-making
Champ in-the-making
What version of Alfresco are you using?

sbeltrami
Champ in-the-making
Champ in-the-making
Alfresco 2.1

ivo_costa
Champ in-the-making
Champ in-the-making
Thanks…

Although this is not the safest way to do it, this info just temporarely solved a problem I had with password definition.
I defined a behaviour that generated the password randomly, so asking for a password on user creation was useless

Now all that I'm missing is a way to remove the textboxes from the dialog, and then work on a v2 of my project Smiley Tongue