Added login function with tests and bcrypt authentication