Code for checking user in DB