public async Task <IActionResult> ForgetPassword_Post(ForgotpasswordModel model) { ResetpasswordModel rModel = new ResetpasswordModel(); if (ModelState.IsValid) { var user = await _userManager.FindByEmailAsync(model.Email); if (user == null) { ModelState.AddModelError("NotFound", "User with this email was not found"); return(View(model)); } try { await user.ForgotPasswordAsync(); } catch (Exception ex) { ModelState.AddModelError("LoginError", ex.Message); } // var result =await _userManager.ConfirmEmailAsync(user, model.Code);//the third parameter is solve the nullReference issue rModel.Email = model.Email; } return(View("ResetPassword", rModel)); //return null; }
public async Task <IActionResult> ForgetPassword(ForgotpasswordModel model) { //var model = new ConfirmModel(); return(View(model)); }