Implemented login function with query to db for email and password