From 88593a3b128192a5989f8c3dfc0e87e08bf11ddc Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 11 Jun 2012 15:36:13 -0400 Subject: [PATCH] Get minimum password length from options --- core.html | 1 + core.js | 13 +++++-------- options.js | 5 ++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/core.html b/core.html index d13ab5b..7b8bf69 100644 --- a/core.html +++ b/core.html @@ -4,6 +4,7 @@ Skeleton Key + diff --git a/core.js b/core.js index 3492c30..7830546 100644 --- 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); } diff --git a/options.js b/options.js index 506b2f8..5d3b447 100644 --- a/options.js +++ b/options.js @@ -21,7 +21,10 @@ (function main() { document.addEventListener('DOMContentLoaded', function() { - var controller = new SkeletonKeyOptions(window); + var win = null; + if (window.location.pathname.indexOf('options.html') != -1) + win = window; + var controller = new SkeletonKeyOptions(win); }); })(); -- 2.43.5