MVC 5의 "비밀번호 분실"부분을 프로젝트에 추가하기 만하면 이메일을받은 후에 비밀번호를 변경할 수 없습니다.ASP.NET 토큰 오류 재설정 암호
오류 : Visual Studio에서 앱 =>Image of error in the app
에서 => 오류에서 온 Image of error visual studio
코드 : I 시도
public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
{
if (!ModelState.IsValid)
{
return View(model);
}
var user = await UserManager.FindByEmailAsync(model.Email);
if (user == null)
{
// Don't reveal that the user does not exist
return RedirectToAction("ResetPasswordConfirmation", "Account");
}
var code = model.Code.Replace(" ","+");
**var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);**
if (result.Succeeded)
{
return RedirectToAction("ResetPasswordConfirmation", "Account");
}
AddErrors(result);
return View();
}
많은 것들에 유래를 찾아 기타는 작동하지 않았습니다.
당신은 내가이 오류 :
내가 비주얼 스튜디오에서 ASP.NET 웹 응용 프로그램의 생성에 제안 된 기본 템플릿을 사용할 수있어 왜 어떤 아이디어를 가지고있는 경우. 원하는 코드 파일을 모두 업로드 할 수 있습니다. 필요한 도움을 요청하면 2 분 안에 업로드 할 수 있습니다!덕분에 당신은 즉, 이메일로 변경 전송하기 전에 당신이 callbackUrl 당신은 인코딩, code
(토큰)를 URL로 필요
string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
를 생성하는 코드 아래 사용하고있는 기본 템플릿을 사용하는 가정
오류를 생성하는 영역의 관련 코드와 함께보고있는 오류를 적어도 포함하면 도움이됩니다. –
나는 @JamesThorpe를 얻는 오류를 보여주기 위해 초기 게시물을 편집했습니다 –