Revize 556
Přidáno uživatelem Roman Ševčík před téměř 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'logged user' => 'Přihlášený uživatel',
|
||
'login data' => 'Přihlašovací údaje',
|
||
'login logs' => 'Logy přihlášení',
|
||
'login must contains only a-z and 0-9 and starts with literal' => 'Pole login musí obsahovat pouze znaky a-z a 0-9 a začínat písmenem.',
|
||
'login name' => 'Přihl. jméno',
|
||
'login_name' => 'Přihl. jméno',
|
||
'login to' => 'Přihlášení',
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
|
||
$form->group('')->label(url_lang::lang('texts.Login data'));
|
||
$form->input('login')->label(url_lang::lang('texts.username').':')
|
||
->rules('required|length[1,50]')
|
||
->rules('required|length[5,20]')
|
||
->callback(array($this, 'valid_username'));
|
||
$form->password('passwd')->label(url_lang::lang('texts.password').':')->rules('required|length[3,50]')->class('required');
|
||
$form->password('confirm_password')->label(url_lang::lang('texts.confirm password').':')->rules('required|length[3,50]')->matches($form->passwd);
|
||
... | ... | |
function valid_username($input)
|
||
{
|
||
$user_model=new User_Model();
|
||
if ($user_model->username_exist($input->value,$this->user_id) || trim($input->value)=='')
|
||
if ($user_model->username_exist($input->value) && !trim($input->value)=='')
|
||
{
|
||
$input->add_error('required', url_lang::lang('texts.Username already exists in database.'));
|
||
$input->add_error('required', url_lang::lang('texts.Username already exists in database'));
|
||
}
|
||
else if (!ereg("^[a-z][a-z0-9]*$", $input->value))
|
||
{
|
||
$input->add_error('required', url_lang::lang('texts.Login must contains only a-z and 0-9 and starts with literal.'));
|
||
}
|
||
}
|
||
|
||
/**
|
freenetis/trunk/kohana/application/controllers/registration.php | ||
---|---|---|
$form = new Forge(url_lang::base()."registration", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->group('')->label(url_lang::lang('texts.login data'));
|
||
$form->input('login')->label(url_lang::lang('texts.username').':')->rules('required|length[3,50]')->callback(array($this, 'valid_username'));
|
||
$form->input('login')->label(url_lang::lang('texts.username').':')->rules('required|length[5,20]')->callback(array($this, 'valid_username'));
|
||
$form->password('passwd')->label(url_lang::lang('texts.password').':')->rules('required|length[3,50]')->class('required');
|
||
$form->password('confirm_password')->label(url_lang::lang('texts.confirm password').':')->rules('required|length[3,50]')->matches($form->passwd);
|
||
$form->group('')->label(url_lang::lang('texts.basic information'));
|
||
... | ... | |
{
|
||
$input->add_error('required', url_lang::lang('texts.Username already exists in database'));
|
||
}
|
||
else if (!ereg("^[a-z][a-z0-9]*$", $input->value))
|
||
{
|
||
$input->add_error('required', url_lang::lang('texts.Login must contains only a-z and 0-9 and starts with literal.'));
|
||
}
|
||
}
|
||
|
||
function valid_phone($input)
|
Také k dispozici: Unified diff
Opraven kontroler registration a members. Jelikož si do loginu dával každý co chtěl, tak je jeho obsah povolen jen a znaky a-z a 0-9 a musí začínat písmenem.