gpt4 book ai didi

ASP.NET身份重置密码

转载 作者:行者123 更新时间:2023-12-03 05:01:09 25 4
gpt4 key购买 nike

如何在新的 ASP.NET Identity 系统中获取用户的密码?或者在不知道当前密码的情况下如何重置(用户忘记密码)?

最佳答案

Or how can I reset without knowing the current one (user forgot password)?

如果您想使用 UserManager 更改密码,但不想提供用户的当前密码,您可以生成密码重置 token ,然后立即使用它。

string resetToken = await UserManager.GeneratePasswordResetTokenAsync(model.Id);
IdentityResult passwordChangeResult = await UserManager.ResetPasswordAsync(model.Id, resetToken, model.NewPassword);

关于ASP.NET身份重置密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19524111/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com