Implemented login validation. Moved api request logic to angular-resource.