Reset Password - password strength

Posted by Community Admin on 05-Aug-2018 18:06

Reset Password - password strength

All Replies

Posted by Community Admin on 30-Oct-2014 00:00

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.

Posted by Community Admin on 04-Nov-2014 00:00

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
 

This thread is closed