Fixed query so that only users in DB can log in.