mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
jQuery default and pwd plugin added and modified.
This commit is contained in:
parent
eeb2023fbe
commit
e7c33909a4
@ -255,12 +255,16 @@ if (isset ($_POST['adduser']))
|
||||
{
|
||||
$_POST['loginname'] = $userMethods->generateUserLogin($pref['predefinedLoginName']);
|
||||
}
|
||||
/*
|
||||
if (isset ($_POST['generatepassword']))
|
||||
{
|
||||
$_POST['password1'] = $userMethods->generateRandomString('**********');
|
||||
// 10-char password should be enough
|
||||
$_POST['password2'] = $_POST['password1'];
|
||||
}
|
||||
*/
|
||||
|
||||
$_POST['password2'] = $_POST['password1'];
|
||||
// Now validate everything
|
||||
$allData = validatorClass :: validateFields($_POST,$userMethods->userVettingInfo,true);
|
||||
// Do basic validation
|
||||
@ -1646,19 +1650,20 @@ class users
|
||||
|
||||
<tr>
|
||||
<td>".USRLAN_62."</td>
|
||||
<td>
|
||||
".$rs->form_password("password1",40,"",20)."
|
||||
".$frm->checkbox_label(USRLAN_171,'generatepassword', 1)."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<td>".$rs->form_password("password1",40,"",20)."</td>
|
||||
</tr>";
|
||||
|
||||
/*
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".USRLAN_63."</td>
|
||||
<td>
|
||||
".$rs->form_password("password2",40,"",20)."
|
||||
</td>
|
||||
</tr>
|
||||
</tr>";
|
||||
*/
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".USRLAN_64."</td>
|
||||
<td>
|
||||
|
@ -62,9 +62,9 @@
|
||||
<core name="e_jslib_gzip">1</core>
|
||||
<core name="e_jslib_nocombine">0</core>
|
||||
<core name="e_jslib_core"><![CDATA[array (
|
||||
'prototype' => 'auto',
|
||||
'prototype' => 'none',
|
||||
'prototype-cdn' => 'none',
|
||||
'jquery' => 'none',
|
||||
'jquery' => 'auto',
|
||||
)]]></core>
|
||||
<core name="e_jslib_plugin"><![CDATA[array ()]]></core>
|
||||
<core name="e_jslib_theme"><![CDATA[array ()]]></core>
|
||||
|
126
e107_files/jslib/password/jquery.pwdMeter.js
Normal file
126
e107_files/jslib/password/jquery.pwdMeter.js
Normal file
@ -0,0 +1,126 @@
|
||||
/**
|
||||
@name jQuery pwdMeter 1.0.1
|
||||
@author Shouvik Chatterjee (mailme@shouvik.net) Modified by e107 Inc.
|
||||
@date 31 Oct 2010
|
||||
@modify 31 Dec 2010
|
||||
@license Free for personal and commercial use as long as the author's name retains
|
||||
*/
|
||||
(function(jQuery){
|
||||
|
||||
jQuery.fn.pwdMeter = function(options){
|
||||
|
||||
|
||||
options = jQuery.extend({
|
||||
|
||||
minLength: 6,
|
||||
displayGeneratePassword: false,
|
||||
generatePassText: 'Generate',
|
||||
generatePassClass: 'GeneratePasswordLink',
|
||||
randomPassLength: 13,
|
||||
passwordBox: this
|
||||
|
||||
}, options);
|
||||
|
||||
var pwdObj = this;
|
||||
|
||||
$(pwdObj).after("<span id=\"pwdMeter\" class=\"neutral\">Very Weak</span>");
|
||||
|
||||
return this.each(function(index){
|
||||
|
||||
$(this).keyup(function(){
|
||||
evaluateMeter();
|
||||
});
|
||||
|
||||
|
||||
function evaluateMeter(){
|
||||
|
||||
var passwordStrength = 0;
|
||||
var password = $(options.passwordBox).val();
|
||||
|
||||
$("#showPwdBox").val(password);
|
||||
|
||||
if ((password.length >0) && (password.length <=5)) passwordStrength=1;
|
||||
|
||||
if (password.length >= options.minLength) passwordStrength++;
|
||||
|
||||
if ((password.match(/[a-z]/)) && (password.match(/[A-Z]/)) ) passwordStrength++;
|
||||
|
||||
if (password.match(/\d+/)) passwordStrength++;
|
||||
|
||||
if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) passwordStrength++;
|
||||
|
||||
if (password.length > 12) passwordStrength++;
|
||||
|
||||
$('#pwdMeter').removeClass();
|
||||
$('#pwdMeter').addClass('neutral');
|
||||
|
||||
switch(passwordStrength){
|
||||
case 1:
|
||||
$('#pwdMeter').addClass('veryweak');
|
||||
$('#pwdMeter').text('Very Weak');
|
||||
break;
|
||||
case 2:
|
||||
$('#pwdMeter').addClass('weak');
|
||||
$('#pwdMeter').text('Weak');
|
||||
break;
|
||||
case 3:
|
||||
$('#pwdMeter').addClass('medium');
|
||||
$('#pwdMeter').text('Medium');
|
||||
break;
|
||||
case 4:
|
||||
$('#pwdMeter').addClass('strong');
|
||||
$('#pwdMeter').text('Strong');
|
||||
break;
|
||||
case 5:
|
||||
$('#pwdMeter').addClass('verystrong');
|
||||
$('#pwdMeter').text('Very Strong');
|
||||
break;
|
||||
default:
|
||||
$('#pwdMeter').addClass('neutral');
|
||||
$('#pwdMeter').text('Very Weak');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(options.displayGeneratePassword){
|
||||
$('#pwdMeter').before(' <a href="#" id="Spn_PasswordGenerator" class="'+options.generatePassClass+'">'+ options.generatePassText +'</a><br />');
|
||||
$('#pwdMeter').after(' <a href="#" id="showPwd">Show</a>');
|
||||
$(pwdObj).after('<input id="showPwdBox" type="text" class="'+ $(pwdObj).attr('class') +'" style="display:none" size="'+ $(pwdObj).attr('size') +'" value="" />');
|
||||
|
||||
}
|
||||
|
||||
$('#Spn_PasswordGenerator').click(function(){
|
||||
var randomPassword = random_password();
|
||||
$('#Spn_NewPassword').text(randomPassword);
|
||||
$(options.passwordBox).val(randomPassword);
|
||||
alert(randomPassword);
|
||||
evaluateMeter();
|
||||
});
|
||||
|
||||
$("#showPwd").click(function () {
|
||||
var id = $(pwdObj).attr("type");
|
||||
$(pwdObj).toggle();
|
||||
$("#showPwdBox").toggle();
|
||||
var text = $(this).text() == 'Show' ? 'Hide' : 'Show';
|
||||
$(this).text(text);
|
||||
|
||||
});
|
||||
|
||||
|
||||
function random_password() {
|
||||
var allowed_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz!?$?%^&*()_-+={[}]:;@~#|\<,>.?/";
|
||||
var pwd_length = options.randomPassLength;
|
||||
var rnd_pwd = '';
|
||||
for (var i=0; i<pwd_length; i++) {
|
||||
var rnd_num = Math.floor(Math.random() * allowed_chars.length);
|
||||
rnd_pwd += allowed_chars.substring(rnd_num,rnd_num+1);
|
||||
}
|
||||
return rnd_pwd;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})(jQuery)
|
56
e107_files/jslib/password/style.css
Normal file
56
e107_files/jslib/password/style.css
Normal file
@ -0,0 +1,56 @@
|
||||
.GeneratePasswordLink{
|
||||
cursor:pointer;
|
||||
color:#084B8A;
|
||||
font-size:10px;
|
||||
}
|
||||
|
||||
.NewPassword{
|
||||
color:#000000;
|
||||
font-size:10px;
|
||||
}
|
||||
|
||||
.neutral{
|
||||
|
||||
|
||||
border:1px solid #000000;
|
||||
background-color:#FFFFFF;
|
||||
}
|
||||
|
||||
.veryweak{
|
||||
border:1px solid #000000;
|
||||
background-color:#B40404;
|
||||
}
|
||||
|
||||
.weak{
|
||||
border:1px solid #000000;
|
||||
background-color:#DF7401;
|
||||
}
|
||||
|
||||
.medium{
|
||||
border:1px solid #000000;
|
||||
background-color:#FFFF00;
|
||||
}
|
||||
|
||||
|
||||
.strong{
|
||||
border:1px solid #000000;
|
||||
background-color:#9AFE2E;
|
||||
}
|
||||
|
||||
|
||||
.verystrong{
|
||||
border:1px solid #000000;
|
||||
background-color:#0B610B;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
|
||||
#pwdMeter {
|
||||
width:150px;
|
||||
padding:2px;
|
||||
color:#000000;
|
||||
font-size:6px;
|
||||
text-align:center;
|
||||
height:12px;
|
||||
display:inline-block;
|
||||
margin-top:4px;
|
||||
}
|
@ -112,6 +112,9 @@ e107::js('core', 'plupload/jquery.plupload.queue/jquery.plupload.queue.js', 'jqu
|
||||
|
||||
e107::css('core', 'chosen/chosen.css', 'jquery');
|
||||
e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2);
|
||||
|
||||
e107::css('core', 'password/style.css', 'jquery');
|
||||
e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2);
|
||||
//
|
||||
|
||||
|
||||
@ -155,6 +158,18 @@ e107::js('inline','
|
||||
$(".e-multiselect").chosen();
|
||||
|
||||
|
||||
// Password
|
||||
$(function() {
|
||||
|
||||
$("#password1").pwdMeter({
|
||||
minLength: 6,
|
||||
displayGeneratePassword: true,
|
||||
generatePassText: "Generate",
|
||||
randomPassLength: 12
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Decorate
|
||||
$(".adminlist tr:even").addClass("even");
|
||||
$(".adminlist tr:odd").addClass("odd");
|
||||
@ -306,7 +321,7 @@ e107::js('inline','
|
||||
});
|
||||
|
||||
// highlight checked row
|
||||
$("input[type=\"checkbox\"].checkbox").click(function(evt){
|
||||
$(".adminlist input[type=\"checkbox\"].checkbox").click(function(evt){
|
||||
|
||||
if(this.checked)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user