Added validation to login form.
Added error handling to api service.