I am using the MVC5 login Identity authentication code below:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginViewModel model, string returnUrl)
{
if (ModelState.IsValid)
{
// Validate the password
IdentityResult result = IdentityManager.Authentication.CheckPasswordAndSignIn(AuthenticationManager, model.UserName, model.Password, model.RememberMe);
if (result.Success)
{
return Redirect("~/home");
}
else
{
AddErrors(result);
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
The code gives a message if the password is not correct but if the username does not exist it gives the same message saying "Incorrect password."
Does anyone out there have a solution that also does a check for the username existing and gives a correct message if it does not exist ? Note that I am using ASP.Net Identity so it would need to be a solution for this and not for the Simple Membership authentication