你如何使用asp.net成员资格提供更改哈希密码,如果你不知道当前密码? [英] How do you change a hashed password using asp.net membership provider if you don't know the current password?
本文介绍了你如何使用asp.net成员资格提供更改哈希密码,如果你不知道当前密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题,有没有方法:
bool ChangePassword(string newPassword);
您必须知道当前的密码(这可能是散列和遗忘)。
You have to know the current password (which is probably hashed and forgotten).
推荐答案
这是一个简单的一个,我浪费了太多的时间。希望这个职位可以节省别人掴他们的额硬和我一样的痛苦。
This is an easy one that I wasted too much time on. Hopefully this post saves someone else the pain of slapping their forehead as hard as I did.
解决方案,随机重置密码,并传递到更改方法。
Solution, reset the password randomly and pass that into the change method.
MembershipUser u = Membership.GetUser();
u.ChangePassword(u.ResetPassword(), "myAwesomePassword");
这篇关于你如何使用asp.net成员资格提供更改哈希密码,如果你不知道当前密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文