text: 'use strict';
  
  angular.module('<%=angularAppName%>')
      .config(function ($stateProvider) {
          $stateProvider
              .state('password', {
                  parent: 'account',
                  url: '/password',
                  data: {
                      roles: ['ROLE_USER']
                  },
                  views: {
                      'content@': {
                          templateUrl: 'app/account/password/password.html',
                          controller: 'PasswordController'
                      }
                  }
              });
      })
      .controller('PasswordController', function ($scope, Auth, Principal) {
          Principal.identity().then(function(account) {
              $scope.account = account;
          });
  
          $scope.success = null;
          $scope.error = null;
          $scope.doNotMatch = null;
          $scope.changePassword = function () {
              if ($scope.password != $scope.confirmPassword) {
                  $scope.doNotMatch = "ERROR";
              } else {
                  $scope.doNotMatch = null;
                  Auth.changePassword($scope.password).then(function () {
                      $scope.error = null;
                      $scope.success = 'OK';
                  }).catch(function () {
                      $scope.success = null;
                      $scope.error = "ERROR";
                  });
              }
          };
      });
  