More in this section

Forums / Developing with Sitefinity / Problem Resetting Password in Code

Problem Resetting Password in Code

4 posts, 0 answered
  1. Les
    Les avatar
    5 posts
    Registered:
    18 Sep 2006
    08 Oct 2008
    Link to this post
    I'm trying to reset a user's password with the following code:

    randomPassword = Membership.Provider.ResetPassword(user.UserName, txtAnswer.Text); 


    My web.config has this setting:

            <membership defaultProvider="Sitefinity" userIsOnlineTimeWindow="15" hashAlgorithmType="">  
                <providers> 
                    <clear/> 
                    <add name="Sitefinity" connectionStringName="DefaultConnection" type="Telerik.DataAccess.AspnetProviders.TelerikMembershipProvider, Telerik.DataAccess" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="(?=.{7,})(?=(.*\d){1,})(?=(.*\W){1,})"/>  
          </providers> 
            </membership> 
     

     
    However, it always throws a MembershipPasswordException. I got it to work with passwordFormat="Clear" so I'm thinking that maybe the "Hashed" setting is wanting me to pass the password answer as hashed.

    Anyone else have this problem? Any ideas on how to get it to work?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Oct 2008
    Link to this post
    Hello Les,

    This is a known bug that will be fixed in our upcoming release which will be announced in the next few days. The problem is related to the Membership provider.

    If you want you could use the attached workaround. To use the attached assembly, you need to substitute the default membership provider with the declaration of the new assembly in the web.config file as shown below:

    <system.web>  
       ...  
       <membership defaultProvider="Sitefinity" userIsOnlineTimeWindow="15" hashAlgorithmType="">  
         <providers>  
         <clear/>  
            <add name="Sitefinity" connectionStringName="DefaultConnection" type="PasswordRecoveryAssembly.TelerikMembershipProviderFix, PasswordRecoveryAssembly" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0"/>  
          </providers>  
       </membership>  

    We recommend to perform upgrade to version 3.5 instead of using this workaround.

    Hope this helps.
     
    Greetings,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Les
    Les avatar
    5 posts
    Registered:
    18 Sep 2006
    09 Oct 2008
    Link to this post

    Thanks for the reponse, Ivan. However, the fix only partially works. It will reset the password once but not a second time.

    I noticed in the telerik_Users database table that the password salt also changed when the password is reset. Is the password salt also used to hash the password answer? If so, then that might be why you can't reset the password again.

    If that is the problem, is it possible for you to send another temporary fix in another DLL?

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    10 Oct 2008
    Link to this post
    Hello Les,

    Sitefinity 3.5 has been released and this issue is fixed. We suggest that you should upgrade your current version. Also, there are other bug fixes that we experienced with version 3.2. Please take a look at our release notes to gather more information - Sitefinity 3.5 Available for Download

    Hope this helps.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered