一、根據賬號取出來當前用戶的實體
var userMgr = scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>(); var userModel = userMgr.FindByNameAsync(account).Result;
二、修改密碼
string code = userMgr.GeneratePasswordResetTokenAsync(userModel).Result; var result = userMgr.ResetPasswordAsync(userModel, code, password);