Get minimum password length from options
[skeletonkey.git] / core.js
diff --git a/core.js b/core.js
index 3492c3003b50676879c63bef4fd174336256615d..7830546a1f6569a2607002b8a49f0cc20ae9e654 100644 (file)
--- a/core.js
+++ b/core.js
@@ -42,6 +42,9 @@ var SkeletonKey = SkeletonKey || function(doc) {
   this._username = doc.getElementById('username');
   this._password = doc.getElementById('password');
   this._generateButton = doc.getElementById('generate');
+
+  this._options = new SkeletonKeyOptions();
+
   this._init();
 };
 
@@ -56,12 +59,6 @@ SkeletonKey.prototype.ITERATIONS = 1000;
  */
 SkeletonKey.prototype.KEYSIZE = 256/32;
 
-/**
- * The minimum length of a password.
- * @const {int}
- */
-SkeletonKey.prototype.MIN_LENGTH = 6;
-
 /**
  * Initializes event handlers for the page.
  * @private
@@ -109,8 +106,8 @@ SkeletonKey.prototype._capitalizeKey = function(key) {
   // it as the basis for capitalizing the key.
   var capsSource = null;
   var keyLength = key.length;
-  if (keyLength / 2 <= this.MIN_LENGTH) {
-    capsSouce = key.substr(0, keyLength - this.MIN_LENGTH);
+  if (keyLength / 2 <= this._options.getMinimumPasswordLength()) {
+    capsSouce = key.substr(0, keyLength - this._options.getMinimumPasswordLength());
   } else {
     capsSource = key.substr(keyLength / 2);
   }