public async Task <ActionResult> ResetPassword(ResetPasswordVM viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var result = await _account.ResetPasswordAsync(viewModel.UserId, viewModel.Code, viewModel.Password);

                    if (result.Succeeded)
                    {
                        return(View("ResetPasswordConfirmation", viewModel));
                    }
                    else
                    {
                        Array.ForEach(result.Errors.ToArray(), e => ModelState.AddModelError("", e));
                    }
                }
                catch (Exception ex)
                {
                    Logger.GetLogger().Error("ResetPassword failed.", ex);
                    ModelState.AddModelError("", ex);
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(viewModel));
        }
        public async Task <ActionResult> ResetPassword(ResetPasswordVM viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var token = viewModel.Code.Replace(" ", "+");
                    // since html replaces '+' with space, we should fix it.
                    var result = await _account.ResetPasswordAsync(viewModel.UserId, token, viewModel.Password);

                    if (result.Succeeded)
                    {
                        return(View("ResetPasswordConfirmation", viewModel));
                    }
                    else
                    {
                        // http://forums.asp.net/t/1934149.aspx?Password+Reset+Token+Expiration
                        // Refer above link for checking the reset password is link expired or not
                        ModelState.AddModelError("",
                                                 "Reset password link has been expired. Please generate the new link.");
                        Array.ForEach(result.Errors.ToArray(), e => ModelState.AddModelError("", e));
                    }
                }
                catch (Exception ex)
                {
                    //Logger.GetLogger().Error("ResetPassword failed.", ex);
                    Logger.GetLogger()
                    .Error(
                        $"ResetPassword failed. Email = {viewModel.Email}; UserId = {viewModel.UserId} Exception = {ex}");
                    ModelState.AddModelError("", ex);
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(viewModel));
        }