2

We added a rule for Password Policy in web.config by changing some properties(minRequiredPasswordLength, passwordStrengthRegularExpression) of SqlMembershipProvider.

Changing password manually in User Manager interface respects this rule fine.

If we generate a random password using Generate button it generates a password that didn't respect our rule. It generates always password with 14 characters.

How can we modify this functionality to force generating password using our rule?

Thanks

1 Answer 1

3

To make this work you need to follow these 5 steps:

  1. Create your own GeneratePassword() method.It should do exactly the same as System.Web.Security.SqlMembershipProvider.GeneratePassword(), but instead of using modulo 87, it should use your custom logic to generate valid passwords.

  2. Create your own SqlMembershipProvider and let it inherit from System.Web.Security.SqlMembershipProvider. The only thing this provider should do is to return your own GeneratePassword() (from step 1) instead of returning from System.Web.Security.Membership.GenereatePassword().

  3. In the web.config file, add your new SqlMembershipProvider (from step 2) into .

  4. In the web.config file, change the SitecoreMembershipProvider to use your own provider (from step 3) instead of Sitecore.Security.SitecoreMembershipProvider

  5. Test the Generate New Password from the Security Manager in Sitecore Desktop

More details can be found in this awesome detailed blog post: http://kirkegaard-at.blogspot.com/2014/06/alphanumeric-characters-in-generate-new.html

Credit goes to Rasmus Kirkegaard Mortensen.

1
  • 1
    Thank you @Peter for your response,that's what I'm searching
    – user1032
    Jul 10, 2018 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.