Moved the User data into a User object managed by angularjs factory.