Beispiel #1
0
        public async Task <IActionResult> ConfirmForgotPasswordPost(ConfirmForgotModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(model.Email).ConfigureAwait(false);

                if (user == null)
                {
                    ModelState.AddModelError("Not Found", "User could not found!");
                    return(View(model));
                }
                try
                {
                    await user.ConfirmForgotPasswordAsync(model.Code, model.Password).ConfigureAwait(false);

                    return(RedirectToAction("Login", "Account"));
                }
                catch (Exception exception)
                {
                    //todo: log
                    ModelState.AddModelError("Code Confirmation Error", exception.Message);
                    return(View(model));
                }
            }
            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> ConfirmForgotPassword()
        {
            var model = new ConfirmForgotModel();

            return(View(model));
        }