When login display URL: https://www.kronowater.com/Account/LogonOV?ReturnUrl=/ and if I forgot the password it display URL: https://www.kronowater.com/Account/LogOnForgot and enter my email address and click send email for password recovery code at same URL: https://www.kronowater.com/Account/LogOnForgot it display input field for the verification code I got in my email box, so I inserted verification code and click set password, after it will display Password Reset for a new password where URL display: https://www.kronowater.com/Account/PasswordReset?VerificationCode=QQT3HAJO and when I enter a new password and click Update Password it gives an error Invalid Recovery code (which I know the reasons of the error), by showing this URL that disappears the verification code URL: https://www.kronowater.com/Account/PasswordReset I just need to add URL path in the form action to take to https://www.kronowater.com/Account/LogOn
public ActionResult PasswordReset(string id, string VerificationCode)
{
string Code = id ?? VerificationCode;
AccountVerification verification = AccountVerification.LoadByCode(Code ?? "");
if (verification != null)
{
ViewBag.Email = verification.EmailAddress;
ViewBag.Username = verification.Name;
}
else
{
ViewBag.Email = "Unknown";
ViewBag.Username = "Unknown";
ModelState.AddModelError("VerificationCode", "Invalid Recovery Code");
}
return View();
}
{
try
{
System.Web.Helpers.AntiForgery.Validate();
}
catch
{
return RedirectToRoute("Default", new { action = "LogOn" });
}
if (!IsValidPassword(model.NewPassword))
ModelState.AddModelError("Password",
List<Customer> cust = Customer.LoadAllByEmail(model.EmailAddress);
Customer customer = cust.Find(e => e.KronoEmail == model.EmailAddress);
AccountVerification code = AccountVerification.LoadByEmailAddress(model.EmailAddress);
if (customer == null || code == null)
ModelState.AddModelError("VerificationCode", "Invalid Recovery Code");
if (ModelState.IsValid)
{
customer.PasswordExpired = false;
customer.Save();
code.Delete();
return RedirectToRoute("Default", new { action = "LogOn" });
}
else
{
// If we got this far, something failed, redisplay form
ViewBag.UserName = model.Username;
ViewBag.Email = model.EmailAddress;
return View("PasswordReset");
}
}