More in this section

Forums / Sitefinity SDK / Reset Password - password strength

Reset Password - password strength

2 posts, 0 answered
  1. Dave
    Dave avatar
    6 posts
    02 Feb 2010
    30 Oct 2014
    Link to this post

    Hi all,

    i am resetting the password of users using the sitefinity api. i cannot get it to use the "PasswordStrengthRegularExpression" to generate the password. 

     here is my code:

    var userManager = new UserManager("Default");
    var sitefinityUser = userManager.GetUser(sitefinityUserId);
    string password = sitefinityUser.ResetPassword();

    in the web.config

    <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity" enablePasswordReset="true" PasswordStrengthRegularExpression="^[0-9a-zA-Z]+$" MinRequiredNonAlphanumericCharacters="0" />

    i can't seem to get it working.

    any help is much appriciated.



  2. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    26 Mar 2015
    04 Nov 2014
    Link to this post
    Hello Dave,

    The correct way to set a regular expression for your user's passwords is under Administration->Settings->Advanced->Security->MembershipProviders->YourProvider->Parameters->passwordStrengthRegularExpression. This expression is saved in your SecurityConfig file, not the web.config one:
            <add passwordStrengthRegularExpression="^[0-9a-zA-Z]+$" enablePasswordRetrieval="true" enablePasswordReset="true" recoveryMailAddress="" name="Default" />

    This will force the user manager to oblige your RegEx when generating a new password.

    Ivan D. Dimitrov
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered