hi,
This leaves you with the check for the status, if the
username/password combo was correct then you have the user record
returned and you can check the status from that.
User user = (from u in db.Users
where u.Username.Equals(username) &&
u.Password.Equals(UserSecurity.GetPasswordHash(username, password))
select u).FirstOrDefault();
if (user == null)
{
// Invalid user name or password
}
else if (user.Status != true)
{
// User inactive
}
else
{
// Success
}
If you must indicate the difference between invalid user name vs invalid password you can do the following.
User user = (from u in db.Users
where u.Username.Equals(username)
select u).FirstOrDefault();
if (user == null)
{
// Invalid user name
}
else if (!user.password.Equals(...))
{
// Invalid password
}
else if (user.Status != true)
{
// User inactive
}
else
{
// Success
}