Revize 1806
Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)
freenetis/branches/1.1/media/js/jquery.validate.password.js | ||
---|---|---|
}
|
||
|
||
$.validator.passwordRating = function(password, username) {
|
||
if (!password || password.length < 8)
|
||
var ln = (window['security_password_length'] != undefined) ? security_password_length : 8;
|
||
if (!password || password.length < ln)
|
||
return rating(0, "too-short");
|
||
if (username && password.toLowerCase().match(username.toLowerCase()))
|
||
return rating(0, "similar-to-username");
|
||
... | ... | |
"strong": "Strong"
|
||
}
|
||
|
||
$.validator.addMethod("password", function(value, element, usernameField) {
|
||
$.validator.addMethod("main_password", function(value, element, usernameField) {
|
||
// use untrimmed value
|
||
var password = element.value,
|
||
// get username for comparison, if specified
|
||
... | ... | |
.addClass("password-meter-message-" + rating.messageKey)
|
||
.text($.validator.passwordRating.messages[rating.messageKey]);
|
||
// display process bar instead of error message
|
||
|
||
return rating.rate > 2;
|
||
var rt = (window['security_password_level'] != undefined) ? security_password_level : 2;
|
||
return rating.rate >= rt;
|
||
}, " ");
|
||
// manually add class rule, to make username param optional
|
||
$.validator.classRuleSettings.password = { password: true };
|
||
$.validator.classRuleSettings.main_password = { main_password: true };
|
||
|
||
})(jQuery);
|
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'minimal duration is one month' => 'Minimální délka je jeden měsíc',
|
||
'minimal duration of interrupt is one month' => 'Minimální délka přerušení je jeden měsíc',
|
||
'minimal latency' => 'Minimální odezva',
|
||
'minimal password length' => 'Minimální délka hesla',
|
||
'minimal password level' => 'Minimální úroveň hesla',
|
||
'minimal suggest amount' => 'Minimální navrhovaná částka',
|
||
'minimum of traffic' => 'Minimální provoz',
|
||
'mod_rewrite is enabled' => 'Mod_rewrite je povolen',
|
||
... | ... | |
'parent wireless interface' => 'Rodičovské bezdrátové rozhraní',
|
||
'parse' => 'Parsovat',
|
||
'partially' => 'Částečně',
|
||
'password' => 'Heslo',
|
||
'password for voip account' => 'Heslo pro VoIP účet',
|
||
'password has been successfully changed' => 'Heslo bylo úspěšně změněno.',
|
||
'password' => 'Heslo',
|
||
'path' => 'Cesta',
|
||
'pay from account' => 'Platit z účtu',
|
||
'payed to' => 'Zaplaceno do',
|
||
... | ... | |
'secondary dns' => 'Sekundární DNS.',
|
||
'section' => 'Sekce',
|
||
'sectional' => 'sektorová',
|
||
'security' => 'Bezpečnost',
|
||
'send' => 'Odeslat',
|
||
'send e-mail notice about received payment to member' => 'Odeslat členovi e-mailovou zprávu s oznámením o jeho přijaté platbě',
|
||
'send mail warning to users related with invoice' => 'Odeslat upozornění uživatelům spojených s fakturou',
|
freenetis/branches/1.1/application/controllers/users.php | ||
---|---|---|
->rules('length[3,30]');
|
||
|
||
$form->group('Password');
|
||
|
||
|
||
$pass_min_len = Settings::get('security_password_length');
|
||
|
||
$form->password('password')
|
||
->rules('required|length[3,50]')
|
||
->class('password');
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->class('main_password');
|
||
|
||
$form->password('confirm_password')
|
||
->rules('required|length[3,50]')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->matches($form->password);
|
||
|
||
$form->group('Additional information');
|
||
... | ... | |
{
|
||
$form->password('oldpassword')
|
||
->label(__('Old password') . ':')
|
||
->rules('required|length[3,50]')
|
||
->rules('required')
|
||
->callback(array($this, 'check_password'));
|
||
}
|
||
|
||
$pass_min_len = Settings::get('security_password_length');
|
||
|
||
$form->password('password')
|
||
->label(__('New password') . ': ' . help::hint('password'))
|
||
->rules('required|length[6,50]')
|
||
->class('password');
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->class('main_password');
|
||
|
||
$form->password('confirm_password')
|
||
->label(__('Confirm new password') . ':')
|
||
->rules('required|length[6,50]')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->matches($form->password);
|
||
|
||
$form->submit('submit')
|
freenetis/branches/1.1/application/controllers/installation.php | ||
---|---|---|
->help(help::hint('login_name'))
|
||
->callback(array($this, 'valid_username'));
|
||
|
||
$pass_min_len = Settings::get('security_password_length');
|
||
|
||
$form->password('password')
|
||
->rules('required|length[3,50]')
|
||
->class('password')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->class('main_password')
|
||
->title(url_lang::lang('help.password'));
|
||
|
||
$form->password('confirm_password')
|
||
->rules('required|length[3,50]')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->matches($form->password);
|
||
|
||
// association
|
freenetis/branches/1.1/application/controllers/registration.php | ||
---|---|---|
->rules('required|length[5,20]')
|
||
->callback(array($this, 'valid_username'));
|
||
|
||
$pass_min_len = Settings::get('security_password_length');
|
||
|
||
$form->password('password')
|
||
->label(__('Password') . ': '.help::hint('password'))
|
||
->rules('required|length[3,50]')
|
||
->class('required')
|
||
->class('password');
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->class('main_password');
|
||
|
||
$form->password('confirm_password')
|
||
->label(__('Confirm password') . ':')
|
||
->rules('required|length[3,50]')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->matches($form->password);
|
||
|
||
$form->group('Basic information');
|
freenetis/branches/1.1/application/controllers/forgotten_password.php | ||
---|---|---|
}
|
||
else
|
||
{
|
||
$pass_min_len = Settings::get('security_password_length');
|
||
|
||
$form = new Forge('forgotten_password?request='.htmlspecialchars($hash));
|
||
|
||
$form->password('password')
|
||
->label('New password')
|
||
->rules('required|length[3,50]')
|
||
->class('password');
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->class('main_password');
|
||
|
||
$form->password('confirm_password')
|
||
->label('Confirm new password')
|
||
->rules('required|length[3,50]')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->matches($form->password);
|
||
|
||
// submit button
|
freenetis/branches/1.1/application/controllers/members.php | ||
---|---|---|
->rules('required|length[5,20]')
|
||
->callback(array($this, 'valid_username'));
|
||
|
||
$pass_min_len = Settings::get('security_password_length');
|
||
|
||
$form->password('password')
|
||
->label(__('Password').': '.help::hint('password'))
|
||
->rules('required|length[3,50]')
|
||
->class('password');
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->class('main_password');
|
||
|
||
$form->password('confirm_password')
|
||
->rules('required|length[3,50]')
|
||
->rules('required|length['.$pass_min_len.',50]')
|
||
->matches($form->password);
|
||
|
||
$form->group('Address of connecting place');
|
freenetis/branches/1.1/application/controllers/settings.php | ||
---|---|---|
->rules('required|valid_numeric')
|
||
->class('increase_decrease_buttons')
|
||
->value($timeout)
|
||
->style('width:30px')
|
||
->help('Time threshold in minutes, before module is shown as inactive');
|
||
|
||
$this->form->group('Security');
|
||
|
||
$this->form->input('security_password_length')
|
||
->label('Minimal password length')
|
||
->rules('required|valid_numeric')
|
||
->class('increase_decrease_buttons')
|
||
->style('width:30px')
|
||
->value(Settings::get('security_password_length'));
|
||
|
||
$pass_levels = array
|
||
(
|
||
1 => __('very weak'),
|
||
2 => __('weak'),
|
||
3 => __('good'),
|
||
4 => __('strong'),
|
||
);
|
||
|
||
$this->form->dropdown('security_password_level')
|
||
->options($pass_levels)
|
||
->label('Minimal password level')
|
||
->rules('required')
|
||
->selected(Settings::get('security_password_level'));
|
||
|
||
$this->form->submit('Save');
|
||
|
||
// form validate
|
||
... | ... | |
{
|
||
$value = str_replace("\n", ",", $value);
|
||
}
|
||
else if ($name == 'security_password_length')
|
||
{
|
||
$value = min(50, max(1, $value)); // <1..50>
|
||
}
|
||
|
||
$issaved = $issaved && Settings::set($name, $value);
|
||
}
|
freenetis/branches/1.1/application/libraries/Settings.php | ||
---|---|---|
'username_regex' => '/^[a-z][a-z0-9_]{4,}$/',
|
||
// default text for self cancel of a cancellable redirection
|
||
'self_cancel_text' => 'OK, I am aware',
|
||
// default minimal password level is good
|
||
'security_password_level' => 3,
|
||
// default minimal password length
|
||
'security_password_length' => 8,
|
||
);
|
||
|
||
/**
|
freenetis/branches/1.1/application/views/forge_template.php | ||
---|---|---|
<?php
|
||
endif;
|
||
|
||
if ($input->name() == 'password'): ?>
|
||
if (mb_stripos($input->class, 'main_password') !== FALSE): ?>
|
||
<div class="password-meter" style="float:right">
|
||
<div class="password-meter-message"> </div>
|
||
<div class="password-meter-bg">
|
freenetis/branches/1.1/application/views/forgotten_password/index.php | ||
---|---|---|
<?php echo html::script('media/js/jquery-ui.min', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.autocomplete.min', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.validate.min', FALSE) ?>
|
||
<script type="text/javascript"><!--
|
||
// settings for jquery.validate.password
|
||
var security_password_level = <?php echo Settings::get('security_password_level') ?>;
|
||
var security_password_length = <?php echo Settings::get('security_password_length') ?>;
|
||
--></script>
|
||
<?php echo html::script('media/js/jquery.validate.password', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.metadata', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.tablesorter.min', FALSE) ?>
|
freenetis/branches/1.1/application/views/installation/index.php | ||
---|---|---|
<?php echo html::script('media/js/jquery-ui.min', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.autocomplete.min', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.validate.min', FALSE) ?>
|
||
<script type="text/javascript"><!--
|
||
// settings for jquery.validate.password
|
||
var security_password_level = <?php echo Settings::get('security_password_level') ?>;
|
||
var security_password_length = <?php echo Settings::get('security_password_length') ?>;
|
||
--></script>
|
||
<?php echo html::script('media/js/jquery.validate.password', FALSE) ?>
|
||
<?php echo html::script('media/js/messages_cs', FALSE) ?>
|
||
<?php echo html::script('media/js/php.min', FALSE) ?>
|
||
<script type="text/javascript">
|
||
$(document).ready(function(){
|
||
$.validator.passwordRating.messages = {
|
||
"too-short": "<?php echo __('Too short') ?>",
|
||
"very-weak": "<?php echo __('Very weak') ?>",
|
||
"weak": "<?php echo __('Weak') ?>",
|
||
"good": "<?php echo __('Good') ?>",
|
||
"strong": "<?php echo __('Strong') ?>"
|
||
}
|
||
|
||
$('form').validate();
|
||
$('#inst_done').hide();
|
||
<script type="text/javascript"><!--
|
||
|
||
$('form').submit(function ()
|
||
$(document).ready(function()
|
||
{
|
||
if ($(this).valid())
|
||
$.validator.passwordRating.messages = {
|
||
"too-short": "<?php echo __('Too short') ?>",
|
||
"very-weak": "<?php echo __('Very weak') ?>",
|
||
"weak": "<?php echo __('Weak') ?>",
|
||
"good": "<?php echo __('Good') ?>",
|
||
"strong": "<?php echo __('Strong') ?>"
|
||
}
|
||
|
||
$('form').validate();
|
||
$('#inst_done').hide();
|
||
|
||
$('form').submit(function ()
|
||
{
|
||
$('#inst_done').show();
|
||
$(this).hide();
|
||
$('p.info_text').hide();
|
||
}
|
||
if ($(this).valid())
|
||
{
|
||
$('#inst_done').show();
|
||
$(this).hide();
|
||
$('p.info_text').hide();
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
});
|
||
</script>
|
||
--></script>
|
||
</head>
|
||
|
||
<body>
|
freenetis/branches/1.1/application/views/main.php | ||
---|---|---|
<?php echo html::script('media/js/jquery-ui.min', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.ui.datepicker-cs', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.validate.min', FALSE) ?>
|
||
<script type="text/javascript"><!--
|
||
// settings for jquery.validate.password
|
||
var security_password_level = <?php echo Settings::get('security_password_level') ?>;
|
||
var security_password_length = <?php echo Settings::get('security_password_length') ?>;
|
||
--></script>
|
||
<?php echo html::script('media/js/jquery.validate.password', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.metadata', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.tablesorter', FALSE) ?>
|
freenetis/branches/1.1/application/views/registration/index.php | ||
---|---|---|
<?php echo html::script('media/js/jquery-ui.min', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.ui.datepicker-cs', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.validate.min', FALSE) ?>
|
||
<script type="text/javascript"><!--
|
||
// settings for jquery.validate.password
|
||
var security_password_level = <?php echo Settings::get('security_password_level') ?>;
|
||
var security_password_length = <?php echo Settings::get('security_password_length') ?>;
|
||
--></script>
|
||
<?php echo html::script('media/js/jquery.validate.password', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.metadata', FALSE) ?>
|
||
<?php echo html::script('media/js/jquery.tablesorter', FALSE) ?>
|
Také k dispozici: Unified diff
Novinky:
- fixes #330: Nastavitelna sila hesla
Upravy:
- udelan poradek ve validatoru hesla (uz se nezobrazuje u aplikacniho hesla, VoIPu, ...)
- validator lze vyvolat tridou main_password