refactored login method to return only one value and added tests