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.
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.
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.
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.
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
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.
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
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
Thank you Tom, you explained it very well and really helpful information .
is working on a reply...