Hashed password cannot be recovered! It's a one way encryption, so decrypting it is impossible. Password reset however should be possible in that case.
Hashed password cannot be recovered! It's a one way encryption, so decrypting it is impossible. Password reset however should be possible in that case.
Cheers,
/Dirk
[/quote]
Ok, I dont foresee that as being a big deal at all, thanks.
I was using the PasswordRecovery control and for it wasn't resetting the members password in Umbraco.
Therefore I hooked into the OnSendingMail event to get the password from the email body and explicitly set in in Umbraco.
initially I tried calling the ResetPassword Membership function and this didn't work (which I suspect is why the password is not set by the control - perhaps this hasn't been defined correctly in the Umbraco provider).
here is my code that currently does the job:
[code]
protected void OnSendingMail(object sender, MailMessageEventArgs e)
{
string newPassword = "";
Regex rgxLines = new Regex("\n");
string[] arrSegments = rgxLines.Split(e.Message.Body);
// extract the password from the email
for (int i = 0; i < arrSegments.Length; i++)
{
if (arrSegments[i].IndexOf("Password: ") >= 0)
{
newPassword = arrSegments[i].Substring(arrSegments[i].IndexOf("Password: ") + 10, arrSegments[i].Length-10);
break;
}
}
TextBox userName = (TextBox)PasswordRecovery1.UserNameTemplateContainer.FindControl("UserName");
// Need to reset it here so it gets hashed in the DB
Membership.Provider.ChangePassword(userName.Text, newPassword, newPassword);
Password Recovery for a membership login v4.0.1
How can I write a password recovery in version 4.0.1? I can not get it to work with hashed passwords...
Hi Evan,
Hashed password cannot be recovered! It's a one way encryption, so decrypting it is impossible. Password reset however should be possible in that case.
Cheers,
/Dirk
[quote=Dirk]Hi Evan,
Hashed password cannot be recovered! It's a one way encryption, so decrypting it is impossible. Password reset however should be possible in that case.
Cheers,
/Dirk
[/quote]
Ok, I dont foresee that as being a big deal at all, thanks.
Evan
I was using the PasswordRecovery control and for it wasn't resetting the members password in Umbraco.
Therefore I hooked into the OnSendingMail event to get the password from the email body and explicitly set in in Umbraco.
initially I tried calling the ResetPassword Membership function and this didn't work (which I suspect is why the password is not set by the control - perhaps this hasn't been defined correctly in the Umbraco provider).
here is my code that currently does the job:
[code]
protected void OnSendingMail(object sender, MailMessageEventArgs e)
{
string newPassword = "";
Regex rgxLines = new Regex("\n");
string[] arrSegments = rgxLines.Split(e.Message.Body);
// extract the password from the email
for (int i = 0; i < arrSegments.Length; i++)
{
if (arrSegments[i].IndexOf("Password: ") >= 0)
{
newPassword = arrSegments[i].Substring(arrSegments[i].IndexOf("Password: ") + 10, arrSegments[i].Length-10);
break;
}
}
TextBox userName = (TextBox)PasswordRecovery1.UserNameTemplateContainer.FindControl("UserName");
// Need to reset it here so it gets hashed in the DB
Membership.Provider.ChangePassword(userName.Text, newPassword, newPassword);
HyperLink btnLogin = (HyperLink)PasswordRecovery1.SuccessTemplateContainer.FindControl("btnLogin");
btnLogin.NavigateUrl = SSLPath.NiceUrlFullyQualifiedPath(iLoginPageID, true, false, false);
}
[/code]
You also need to make enablePasswordReset="true" in the UmbracoMembershipProvider section of the web.config
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.