<commit_before>/**
 * This file contains all necessary Angular controller definitions for 'frontend.admin.login-history' module.
 *
 * Note that this file should only contain controllers and nothing else.
 */
(function() {
  'use strict';

  angular.module('frontend.users')
    .controller('UserController', [
      '_','$scope','$q','$log','UserService','MessageService','$state','DialogService','UserModel','_user',
      function controller(_,$scope,$q,$log, UserService, MessageService,$state,DialogService,UserModel,_user ) {

          // Set current scope reference to models
          UserModel.setScope($scope, 'user');

          // Expose necessary data
          $scope.user = _user;
          initUserPassports()
          $scope.authUser = UserService.user();

          // User delete dialog buttons configuration
          $scope.confirmButtonsDelete = {
              ok: {
                  label: 'Delete',
                  className: 'btn-danger btn-link',
                  callback: function callback() {
                      $scope.deleteUser();
                  }
              },
              cancel: {
                  label: 'Cancel',
                  className: 'btn-default btn-link'
              }
          };

          // Scope function to save modified user.
          $scope.saveUser = function saveUser() {

              var data = angular.copy($scope.user);

              // Make actual data update
              var deferred = $q.defer();
              UserModel
                  .update(data.id, data)
                  .then(
                      function onSuccess(data) {
                          $scope.showForm = false;
                          MessageService.success('User "' + $scope.user.username + '" updated successfully');
                          initUserPassports()
                          UserService.updateUser(data.data)
                          deferred.resolve(true);
                      },function(err){
                          UserModel.handleError($scope,err)
                          deferred.reject('Error');
                      }
                  );

              return deferred.promise;
          };

          // Scope function to delete user
          $scope.deleteUser = function deleteUser() {
              UserModel
                  .delete($scope.user.id)
                  .then(
                      function onSuccess() {
                          MessageService.success('User "' + $scope.user.username + '" deleted successfully');
                          $state.go('users');
                      }
                  )
              ;
          };

          $scope.cancelEditing = function() {
              $scope.editableForm.$cancel()
              initUserPassports()
          }

          function initUserPassports() {
              $scope.user.passports = {
                  password : "",
                  protocol : 'local'
              }
              $scope.user.password_confirmation = undefined
          }

      }
    ])
  ;
}());<commit_msg>Fix user password update<commit_after>/**
 * This file contains all necessary Angular controller definitions for 'frontend.admin.login-history' module.
 *
 * Note that this file should only contain controllers and nothing else.
 */
(function() {
  'use strict';

  angular.module('frontend.users')
    .controller('UserController', [
      '_','$scope','$q','$log','UserService','MessageService','$state','DialogService','UserModel','_user',
      function controller(_,$scope,$q,$log, UserService, MessageService,$state,DialogService,UserModel,_user ) {

          // Set current scope reference to models
          UserModel.setScope($scope, 'user');

          // Expose necessary data
          $scope.user = _user;
          initUserPassports()
          $scope.authUser = UserService.user();

          // User delete dialog buttons configuration
          $scope.confirmButtonsDelete = {
              ok: {
                  label: 'Delete',
                  className: 'btn-danger btn-link',
                  callback: function callback() {
                      $scope.deleteUser();
                  }
              },
              cancel: {
                  label: 'Cancel',
                  className: 'btn-default btn-link'
              }
          };

          // Scope function to save modified user.
          $scope.saveUser = function saveUser() {

              var data = angular.copy($scope.user);

              // Make actual data update
              var deferred = $q.defer();
              UserModel
                  .update(data.id, data)
                  .then(
                      function onSuccess(data) {
                          $scope.showForm = false;
                          MessageService.success('User "' + $scope.user.username + '" updated successfully');
                          initUserPassports()
                          UserService.updateUser(data.data)
                          deferred.resolve(true);
                      },function(err){
                          UserModel.handleError($scope,err)
                          deferred.reject('Error');
                      }
                  );

              return deferred.promise;
          };

          // Scope function to delete user
          $scope.deleteUser = function deleteUser() {
              UserModel
                  .delete($scope.user.id)
                  .then(
                      function onSuccess() {
                          MessageService.success('User "' + $scope.user.username + '" deleted successfully');
                          $state.go('users');
                      }
                  )
              ;
          };

          $scope.cancelEditing = function() {
              $scope.editableForm.$cancel()
              initUserPassports()
          }

          function initUserPassports() {
              $scope.user.passports = {
                  password : "",
                  protocol : 'local'
              }
              $scope.user.password_confirmation = undefined
          }

          initUserPassports()

      }
    ])
  ;
}());
{'fraction_non_alphanumeric': 0.1080906148867314, 'fraction_numerical': 0.0, 'mean_word_length': 1.2757731958762886, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4103530', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1368, 'n_words': 284}