text: 'use strict';
  
  angular.module('in100gramApp')
      .controller('SettingsController', function ($scope, Principal, Auth) {
          $scope.success = null;
          $scope.error = null;
          Principal.identity(true).then(function(account) {
              $scope.settingsAccount = account;
          });
  
          $scope.save = function () {
              Auth.updateAccount($scope.settingsAccount).then(function() {
                  $scope.error = null;
                  $scope.success = 'OK';
                  Principal.identity().then(function(account) {
                      $scope.settingsAccount = account;
                  });
              }).catch(function() {
                  $scope.success = null;
                  $scope.error = 'ERROR';
              });
          };
      });
  