text: (function () {
    'use strict';
  
    // Users service used for communicating with the users REST endpoint
    angular
      .module('users.services')
      .factory('UsersService', UsersService);
  
    UsersService.$inject = ['$resource'];
  
    function UsersService($resource) {
      var Users = $resource('/api/users', {}, {
        update: {
          method: 'PUT'
        },
        updatePassword: {
          method: 'POST',
          url: '/api/users/password'
        },
        deleteProvider: {
          method: 'DELETE',
          url: '/api/users/accounts',
          params: {
            provider: '@provider'
          }
        },
        sendPasswordResetToken: {
          method: 'POST',
          url: '/api/auth/forgot'
        },
        resetPasswordWithToken: {
          method: 'POST',
          url: '/api/auth/reset/:token'
        },
        signup: {
          method: 'POST',
          url: '/api/auth/signup'
        },
        signin: {
          method: 'POST',
          url: '/api/auth/signin'
        },
        getUserProjectDetails: {
          method: 'GET',
          url: '/api/users/projectInfo'
        },
        getUsers: {
          method: 'GET',
          url: '/api/users/list',
          isArray: true
        }
      });
  
      angular.extend(Users, {
        changePassword: function (passwordDetails) {
          return this.updatePassword(passwordDetails).$promise;
        },
        removeSocialAccount: function (provider) {
          return this.deleteProvider({
            provider: provider // api expects provider as a querystring parameter
          }).$promise;
        },
        requestPasswordReset: function (credentials) {
          return this.sendPasswordResetToken(credentials).$promise;
        },
        resetPassword: function (token, passwordDetails) {
          return this.resetPasswordWithToken({
            token: token // api expects token as a parameter (i.e. /:token)
          }, passwordDetails).$promise;
        },
        userSignup: function (credentials) {
          return this.signup(credentials).$promise;
        },
        userSignin: function (credentials) {
          return this.signin(credentials).$promise;
        }
      });
  
      return Users;
    }
  
    // TODO this should be Users service
    angular
      .module('users.admin.services')
      .factory('AdminService', AdminService);
  
    AdminService.$inject = ['$resource'];
  
    function AdminService($resource) {
      return $resource('/api/users/:userId', {
        userId: '@_id'
      }, {
        update: {
          method: 'PUT'
        }
      });
    }
  }());
  