Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shwetha Shankar 21 posts 41 karma points
    Feb 03, 2011 @ 18:17
    Shwetha Shankar
    0

    Password reset for members

    Hi,

    I am trying to build a password reset service for a website that I have built on Umbraco. Below is the code that I am using.

    Member thisMember = Member.GetMemberFromEmail(GetMemberEmail());
    if (thisMember != null)
    {
            try
            {
                    thisMember.ChangePassword(NewPasswordText.Text);
                    thisMember.Save();
                    PasswordResetSuccess.Visible = true;                       
            }
            catch (Exception ex)
            {
            }
    }

    However, although I don't encounter any exceptions, the password is not updated. When I have a look at the cmsMember table, the row for the user has a blank column for the password.

    Please, can you tell me what I am missing.

    Thanks for your help with this.

    Regards,
    Shwetha

  • Shwetha Shankar 21 posts 41 karma points
    Feb 03, 2011 @ 19:07
    Shwetha Shankar
    0

    I was able to figure this out.

    I needed to change the web.config setting to enablePasswordReset = true.

    Also, realised that instead of doing a thisMember.ChangePassword(NewPasswordText.Text), its better to do thisMember.Password = NewPasswordText.Text.Trim(); since this will hash the password and then save it to the member.

  • saif 68 posts 88 karma points
    Jan 06, 2012 @ 11:52
    saif
    0

    Hi Shwetha,

    I am newbie to Umbraco please could you tell me how to use this c# code in umbraco. I know how to use this code in web application but never use in umbraco.

    Till now I just created a documents types and template but no code has used yet.

    kind regards

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 06, 2012 @ 14:15
    Tom Fulton
    0

    Hi,

    You can use it pretty much the same way as in a web application.  Basically you should create a Usercontrol with your code, copy it to /usercontrols/ and the DLL to /bin/, then you can create a Macro and select your usercontrol. Then you can insert that macro into your template.

    More info here:  http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/developer-introduction/using-net-user-controls/TVPlayer

    Hope this helps,
    Tom

  • saif 68 posts 88 karma points
    Jan 06, 2012 @ 16:28
    saif
    0

    Thank you Tom, you explained it very well and really helpful information .

Please Sign in or register to post replies

Write your reply to:

Draft