public async Task<IActionResult> Callback(string userId = null, string code = null)
 {
     logger.Trace("GET Callback({0},{1})", userId, code);
     if (userId == null || code == null) {
         logger.Error("User is null or code is null");
         return View("CallbackError");
     }
     var user = await userManager.FindByIdAsync(userId);
     if (user == null) {
         logger.Error("User ID = {0} does not exist", userId);
         return View("CallbackError");
     }
     logger.Trace("Found user {0}", user.Email);
     ResetPasswordVM model = new ResetPasswordVM { Email = user.Email, Code = code };
     return View("ResetPassword", model);
 }
        public async Task<IActionResult> ResetPassword(ResetPasswordVM model)
        {
            logger.Trace("POST ResetPassword()");
            if (!ModelState.IsValid) {
                logger.Trace("Model is not valid - showing view again");
                return View(model);
            }

            logger.Trace("Finding user by email {0}", model.Email);
            var user = await userManager.FindByEmailAsync(model.Email);
            if (user == null) {
                logger.Trace("User does not exist: pretending to be successful");
                return RedirectToAction("Success", "ForgotPassword");
            }
            logger.Trace("Resetting password with code = {0}", model.Code);
            var result = await userManager.ResetPasswordAsync(user, model.Code, model.Password);
            if (result.Succeeded) {
                logger.Trace("Reset Password for {0} succeeded", model.Email);
                return RedirectToAction("Success", "ForgotPassword");
            }
            foreach (var error in result.Errors) {
                ModelState.AddModelError("", error.Description);
            }
            logger.Error("Reset Password form had issues - re-displaying");
            return View(model);
        }