From 726cfac80d1faf6dfb703098b7da924bf83e3b61 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Fri, 18 May 2012 05:57:23 -0400
Subject: [PATCH] - Added "Generate Password" function to all modules. - Random password length: by default, generated passwords will have a length between 10 and 15 characters (instead of a fixed length of 10 characters).
---
interface/web/js/scrigo.js.php | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index 6fa893b..cc6a80f 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -526,11 +526,13 @@
return rv;
}
-function password(length, special) {
+function password(minLength, special){
var iteration = 0;
var password = "";
var randomNumber;
- length = length || 10;
+ minLength = minLength || 10;
+ var maxLength = minLength + 5;
+ var length = getRandomInt(minLength, maxLength);
if(special == undefined){
var special = false;
}
@@ -555,3 +557,8 @@
oldPWField.remove();
newPWField.attr('id', passwordFieldID).val(password(10, true)).trigger('keyup');
}
+
+function getRandomInt(min, max){
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+}
+
--
Gitblit v1.9.1