samedi 4 avril 2015

Database validation returning false after user input


Vote count:

0




Project files: http://ift.tt/1NIJgmM


Relevant files I'm referring to: http://ift.tt/1bVLIuB


So I have this procedure called 'IsValid' in MyTemplateController:



[HttpPost]
public ActionResult LogIn(UserModel user)
{
if (ModelState.IsValid)
{
if (user.IsValid(user.Email, user.Password))
{
FormsAuthentication.SetAuthCookie(user.Email, false);
return RedirectToAction("Index", "MyTemplate");
}
else
{
ModelState.AddModelError("", "Login Data is Incorrect!");
}
}
return View(user);
}


It checks the database for a valid email address and password combination from my database.


The database consists of an Email, Password (encrypted), Password Salt, FirstName, Surname and finally Age. http://ift.tt/1bVLFPp


Now, if I remove the 'First Name', 'Surname' and 'Age' from the UserModel + 'ActionResult Registration' (where it says sysUser.FirstName = user.FirstName), the whole system works fine and I am able to log in.


However, if I place back the items I removed, the 'IsValid' procedure returns as being false at line 27 of the MyTemplateController Gist.


Can anyone explain why this happens?


Thanks.



asked 1 min ago







Database validation returning false after user input

Aucun commentaire:

Enregistrer un commentaire