Пользовательск ого поиска

Главная » Файлы » Web » Скрипты для Ucoz

Проверка сложности пароля
  08.02.2009, 15:39
.Украшаем проверку сложности пароля. Вроде неплохо получается...

1.Между <head></head> страницы регистрации
Quote
<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>

<script type="text/javascript">
$.fn.passwordStrength = function( options ){
return this.each(function(){
var that = this;that.opts = {};
that.opts = $.extend({}, $.fn.passwordStrength.defaults, options);

that.div = $(that.opts.targetDiv);
that.defaultClass = that.div.attr('class');

that.percents = (that.opts.classes.length) ? 100 / that.opts.classes.length : 100;

v = $(this)
.keyup(function(){
if( typeof el == "undefined" )
this.el = $(this);
var s = getPasswordStrength (this.value);
var p = this.percents;
var t = Math.floor( s / p );

if( 100 <= s )
t = this.opts.classes.length - 1;

this.div
.removeAttr('class')
.addClass( this.defaultClass )
.addClass( this.opts.classes[ t ] );

})
.after('')
.next()
.click(function(){
$(this).prev().val ( randomPassword() ).trigger('keyup');
return false;
});
});

function getPasswordStrength(H){
var D=(H.length);
if(D>5){
D=5
}
var F=H.replace(/[0-9]/g,"");
var G=(H.length-F.length);
if(G>3){G=3}
var A=H.replace(/\W/g,"");
var C=(H.length-A.length);
if(C>3){C=3}
var B=H.replace(/[A-Z]/g,"");
var I=(H.length-B.length);
if(I>3){I=3}
var E=((D*10)-20)+(G*10)+(C*15)+(I*10);
if(E<0){E=0}
if(E>100){E=100}
return E
}

function randomPassword() {
var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$_+";
var size = 10;
var i = 1;
var ret = ""
while ( i <= size ) {
$max = chars.length-1;
$num = Math.floor(Math.random()*$max);
$temp = chars.substr($num, 1);
ret += $temp;
i++;
}
return ret;
}

};

$.fn.passwordStrength.defaults = {
classes : Array('is10','is20','is30','is40','is50','is60','is70','is80','is90','is100'),
targetDiv : '#passwordStrengthDiv',
cache : {}
}
$(document)
.ready(function(){
$('input[name="password"]').passwordStrength();
});
</script>

2. CSS

Quote
.is0{background:url("http://kbh.mg.by/progressImg1.png") no-repeat 0 0;width:138px;height:7px;}
.is10{background-position:0 -7px;}
.is20{background-position:0 -14px;}
.is30{background-position:0 -21px;}
.is40{background-position:0 -28px;}
.is50{background-position:0 -35px;}
.is60{background-position:0 -42px;}
.is70{background-position:0 -49px;}
.is80{background-position:0 -56px;}
.is90{background-position:0 -63px;}
.is100{background-position:0 -70px;}

3.
Главная » Управление дизайном » Редактирование шаблонов - Форма регистрации пользователей
Заменяем (по умолчанию):
Quote

<tr id="siM45"><td class="manTd1" id="siM46">$PASSWORD_SIGN$</td><td class="manTd2" id="siM47">$PASSWORD_FL$</td>
</tr>

на
Quote

<tr id="siM45"><td class="manTd1" id="siM46">$PASSWORD_SIGN$</td><td class="manTd2" id="siM47">$PASSWORD_FL$</td>
</tr><tr><td>Проверка безопасности: </td><td><div id="passwordStrengthDiv" class="is0"></div></td>
</tr>

Просмотров: 2423 Загрузок: 0 Дата: 08.02.2009 Рейтинг: 0.0/0 |

Другие программы

RSS
Michael Zacharias Ultimate Tools PackStick 2.8.0.72
Swish Max 1.0EVEREST Ultimate Edition 3.51.909 Beta
Resco Explorer 2005 5.42Active Ball 1.8
OSL2000 Boot Manager 9.06 PlatinumWinki The Ripper 0.4.5
Nero Burning Rom 7.0.5.4 / 6.6.1.4Metro 5.6.8
Всего комментариев : 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
-->

Навигация

Пользователь

  • Привет, Гость

    .

    Гость, мы рады вас видеть. Пожалуйста зарегистрируйтесь или авторизуйтесь!

Рекомендуем

Рекомендуем

Рекомендуем

  • Ваш пол

    Результат опроса Результаты
    Все опросы нашего сайта Архив опросов

    Всего голосовало: 14


    Онлайн всего: 1
    Гостей: 1
    Пользователей: 0

Gry Online

Gry Online

86 gier i wszystkie za darmo!

Poczta + www

Poczta + www

30% taniej w pakiecie!