Мод за сигурна парола
Автор: djvato
Здравейте … ето ви един мод найстина полезен ето ви демо още от сега и ще разберете за какво става дума :
#
#-----[ отваряте ]------------------------------------------------------------------
#
includes/usercp_register.php
#
#-----[ намирате ]------------------------------------------------------------------
#
'L_PASSWORD_CONFIRM_IF_CHANGED' => ( $mode == 'editprofile' ) ? $lang['password_confirm_if_changed'] : '',
#
#-----[ след недо добавяте ]------------------------------------------------------------
#
'L_PASSWORD_SECURITY_LEVEL1' => $lang['password_security_level1'],
'L_PASSWORD_SECURITY_LEVEL2' => $lang['password_security_level2'],
'L_PASSWORD_SECURITY_LEVEL3' => $lang['password_security_level3'],
'L_PASSWORD_SECURITY_LEVEL4' => $lang['password_security_level4'],
'L_PASSWORD_SECURITY_LEVEL5' => $lang['password_security_level5'],
'L_PASSWORD_SECURITY_EXPLAIN' => $lang['password_security_explain'],
#
#-----[ отваряте ]------------------------------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ намирате ]------------------------------------------------------------------
#
<td class="row2">
<input type="password" class="post" style="width: 200px" name="new_password" size="25" maxlength="32" value="{NEW_PASSWORD}" />
#
#-----[ заменяте с ]----------------------------------------------------------
#
<td class="row2" nowrap="nowrap">
<script language="JavaScript" type="text/javascript">
<!--
// Password security
function check_pw(pw_to_check)
{
var counter_to_check = 0;
var minlength_to_check = 6;
if (pw_to_check.length >= minlength_to_check)
{
counter_to_check = counter_to_check + 1;
}
if (pw_to_check.match(/[A-Z\Д\Ц\Ь]/))
{
counter_to_check = counter_to_check + 2;
}
if (pw_to_check.match(/[a-z\д\ц\ь\Я]/))
{
counter_to_check = counter_to_check + 1;
}
if (pw_to_check.match(/[0-9]/))
{
counter_to_check = counter_to_check + 2;
}
if (pw_to_check.match(/[\.\,\?\!\%\*\_\#\:\;\~\\&\$\§\Ђ\@\/\=\+\-\(\)\[\]\|\<\>]/))
{
counter_to_check = counter_to_check + 2;
}
if (pw_to_check == document.getElementsByName('username').username.value)
{
counter_to_check = 0;
}
if (pw_to_check == document.getElementsByName('email').email.value)
{
counter_to_check = 0;
}
if (counter_to_check <= 2)
{
document.getElementsByName('holder_pw')[0].style.backgroundColor = 'red';
document.getElementsByName('holder_pw')[0].style.color = 'black';
document.getElementsByName('holder_pw')[0].style.border = '1px solid black';
document.getElementsByName('holder_pw')[0].value = '{L_PASSWORD_SECURITY_LEVEL1}';
}
else if (counter_to_check <= 4)
{
document.getElementsByName('holder_pw')[0].style.backgroundColor = 'yellow';
document.getElementsByName('holder_pw')[0].style.color = 'black';
document.getElementsByName('holder_pw')[0].style.border = '1px solid black';
document.getElementsByName('holder_pw')[0].value = '{L_PASSWORD_SECURITY_LEVEL2}';
}
else if (counter_to_check <= 5)
{
document.getElementsByName('holder_pw')[0].style.backgroundColor = 'green';
document.getElementsByName('holder_pw')[0].style.color = 'white';
document.getElementsByName('holder_pw')[0].style.border = '1px solid black';
document.getElementsByName('holder_pw')[0].value = '{L_PASSWORD_SECURITY_LEVEL3}';
}
else if (counter_to_check <= 7)
{
document.getElementsByName('holder_pw')[0].style.backgroundColor = 'green';
document.getElementsByName('holder_pw')[0].style.color = 'white';
document.getElementsByName('holder_pw')[0].style.border = '1px solid black';
document.getElementsByName('holder_pw')[0].value = '{L_PASSWORD_SECURITY_LEVEL4}';
}
else if (counter_to_check == 8)
{
document.getElementsByName('holder_pw')[0].style.backgroundColor = 'green';
document.getElementsByName('holder_pw')[0].style.color = 'white';
document.getElementsByName('holder_pw')[0].style.border = '1px solid black';
document.getElementsByName('holder_pw')[0].value = '{L_PASSWORD_SECURITY_LEVEL5}';
}
}
//-->
</script>
<input onkeyup="check_pw(this.value);" onfocus="check_pw(this.value);" type="password" class="post" style="width: 200px" name="new_password" size="25" maxlength="32" value="{NEW_PASSWORD}" />
<span class="gensmall">[ <a href="{U_FAQ}#39" tabindex="98" target="_phpbbfaq">{L_PASSWORD_SECURITY_EXPLAIN}</a> ]</span> <input tabindex="99" title="" readonly="readonly" type="text" class="post" style="width : 150px; text-align : center; border : 1px solid #DEE3E7; background-color : #DEE3E7;" name="holder_pw" size="25" value="" />
#
#-----[ отваряте]------------------------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ намирате ]------------------------------------------------------------------
#
$lang['password_confirm_if_changed'] =
#
#-----[ след него добавяте ]------------------------------------------------------------
#$lang[‘password_security_level1’] = ‘Несигурна’;
$lang[‘password_security_level2’] = ‘Не много сигурна’;
$lang[‘password_security_level3’] = ‘Относително безопасна ‘;
$lang[‘password_security_level4’] = ‘Безопасна’;
$lang[‘password_security_level5’] = ‘Найстина пезопасна’;
$lang[‘password_security_explain’] = ‘FAQ’;
Успех !


