From 43fd5ec7873c01ee882ca63ceb4b5ca79a204cac Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 12 Dec 2011 16:04:38 -0500 Subject: [PATCH] Add rules to process special case password generations. --- index.php | 12 +++++++----- js/rules.js | 6 ++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100755 js/rules.js diff --git a/index.php b/index.php index 0426f83..aac93ae 100755 --- a/index.php +++ b/index.php @@ -45,6 +45,7 @@ head.js('js/jquery.corner.min.js'); head.js('js/jquery.zclip.min.js'); head.js('js/jquery.md5.min.js'); + head.js('js/rules.js'); head.ready(function() { $('input').corner('round 4px'); @@ -54,7 +55,11 @@ //queroy.autocomplete to / ajax / etc. $('#generate input').change(function() { - $('#password').val($.md5($('#root').val() + $('#master').val())); + if($('#root').val() in special) { + $('#password').val(special[$('#root').val()]($.md5($('#root').val() + $('#master').val()))); + } else { + $('#password').val($.md5($('#root').val() + $('#master').val())); + } }); $('#copy').zclip({ @@ -62,10 +67,7 @@ copy: function() { return $('#password').val() }, - afterCopy: function() { - $.post('update.php', { site: $('#root').val() }, - function(data) {}); - } + afterCopy: function() {} }); }); diff --git a/js/rules.js b/js/rules.js new file mode 100755 index 0000000..c5a28bb --- /dev/null +++ b/js/rules.js @@ -0,0 +1,6 @@ +var special = new Array(); + +special['53.com'] = (function(password) { + // 6-12 characters + return password.substr(0,12); +}); \ No newline at end of file