Reset Password - password strength - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Reset Password - password strength

  • Reset Password - password strength
  • 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();
    userManager.SaveChanges();

    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.

    Thanks,

    Tony.

  • 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:
    <membershipProviders>
            <add passwordStrengthRegularExpression="^[0-9a-zA-Z]+$" enablePasswordRetrieval="true" enablePasswordReset="true" recoveryMailAddress="user@domain.com" name="Default" />
        </membershipProviders>

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

    Regards,
    Ivan D. Dimitrov
    Telerik
     
    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