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
>