Forráskód Böngészése

AMBARI-2620. Weak database passwords cause Hive fail to start. (Diego Pereira Domingos via srimanth)

Srimanth Gunturi 11 éve
szülő
commit
aa4b88fed9

+ 5 - 0
ambari-web/app/models/service_config.js

@@ -584,6 +584,11 @@ App.ServiceConfigProperty = Ember.Object.extend({
             this.set('errorMessage', 'Passwords do not match');
             isError = true;
           }
+          else if (!validator.isValidPassword(value)){
+            this.set('errorMessage', 'Weak password: too short.');
+            isError = true;
+          }
+
       }
     }
 

+ 11 - 1
ambari-web/app/utils/validator.js

@@ -105,6 +105,16 @@ module.exports = {
     return usernameRegex.test(value);
   },
 
+  /**
+   * validate password
+   * @param value
+   * #return {Boolean}
+   */
+  isValidPassword: function(value) {
+    var passwordRegex = /^.{5,}$/;
+    return passwordRegex.test(value);
+  },
+
   /**
    * validate key of configurations
    * @param value
@@ -128,4 +138,4 @@ module.exports = {
         return false;
     }
 }
-};
+};