<commit_before>'use strict';

// PasswordValidator service used for testing the password strength
angular.module('users').factory('PasswordValidator', ['$window', '$translate',
  function ($window, $translate) {
    var owaspPasswordStrengthTest = $window.owaspPasswordStrengthTest;

    return {
      getResult: function (password) {
        return new Promise((resolve, reject) => {
          var result = { errors: [] };
          var check = 0;
          if (password.length < 8) {
            $translate('MS_PASS_MINLENGTH_ERROR').then(tsl => {
              result.errors.push[tsl];
              check += 1;
            });
          } else {
            check += 1;
          }
          if (password.length > 32) {
            $translate('MS_PASS_MAXLENGTH_ERROR').then(tsl => {
              result.errors.push[tsl];
              check += 1;
            });
          } else {
            check += 1;
          }
          if(/^[a-zA-Z0-9- ]*$/.test(str) === false) {
            $translate('MS_PASS_ILLEGAL_ERROR').then(tsl => {
              result.errors.push[tsl];
              check += 1;
            });
          } else {
            check += 1;
          }
          while(true) {
            if (check === 3) {
              return resolve(result);
            }
          }
        });
      },
      getPopoverMsg: function () {
        var popoverMsg = 'Please enter a passphrase or password with greater than 10 characters, numbers, lowercase, upppercase, and special characters.';
        return popoverMsg;
      }
    };
  }
]);<commit_msg>Commited from lenh at Fri, Sep 01, 2017 11:54:02 AM<commit_after>'use strict';

// PasswordValidator service used for testing the password strength
angular.module('users').factory('PasswordValidator', ['$window', '$translate',
  function ($window, $translate) {
    var owaspPasswordStrengthTest = $window.owaspPasswordStrengthTest;

    return {
      getResult: function (password) {
        return new Promise((resolve, reject) => {
          var result = { errors: [] };
          var check = 0;
          if (password.length < 8) {
            $translate('MS_PASS_MINLENGTH_ERROR').then(tsl => {
              result.errors.push(tsl);
              check += 1;
            });
          } else {
            check += 1;
          }
          if (password.length > 32) {
            $translate('MS_PASS_MAXLENGTH_ERROR').then(tsl => {
              result.errors.push(tsl);
              check += 1;
            });
          } else {
            check += 1;
          }
          if(/^[a-zA-Z0-9- ]*$/.test(password) === false) {
            $translate('MS_PASS_ILLEGAL_ERROR').then(tsl => {
              result.errors.push(tsl);
              check += 1;
            });
          } else {
            check += 1;
          }
          while(true) {
            if (check === 3) {
              return resolve(result);
            }
          }
        });
      },
      getPopoverMsg: function () {
        var popoverMsg = 'Please enter a passphrase or password with greater than 10 characters, numbers, lowercase, upppercase, and special characters.';
        return popoverMsg;
      }
    };
  }
]);
{'fraction_non_alphanumeric': 0.13266268469034895, 'fraction_numerical': 0.013203395158755108, 'mean_word_length': 1.6081967213114754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2404495', 'n_tokens_mistral': 919, 'n_tokens_neox': 867, 'n_words': 193}