Refactor AngularJS user controller