+1-888-365-2779
Try Now
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
    Registered:
    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();
    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.

  2. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    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:
    <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
     
2 posts, 0 answered