1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00
This commit is contained in:
Mzhelskiy Maxim 2015-04-21 10:42:59 +07:00
parent 564c809d8a
commit 9581c32553
3 changed files with 52 additions and 30 deletions

View file

@ -27,30 +27,6 @@
*/
class ModuleUser_EntityUser extends Entity
{
/**
* Определяем дополнительные правила валидации
*
* @param array|bool $aParam
*/
public function __construct($aParam = false)
{
$sCaptchaValidateType = func_camelize('captcha_' . Config::Get('sys.captcha.type'));
if (Config::Get('module.user.captcha_use_registration')) {
$this->aValidateRules[] = array(
'captcha',
$sCaptchaValidateType,
'name' => 'user_signup',
'on' => array('registration')
);
}
if (Config::Get('general.login.captcha')) {
$this->aValidateRules[] = array('captcha', $sCaptchaValidateType, 'name' => 'user_auth', 'on' => array('signIn'));
}
parent::__construct($aParam);
}
/**
* Определяем правила валидации
*
@ -61,10 +37,55 @@ class ModuleUser_EntityUser extends Entity
array('login', 'login_exists', 'on' => array('registration')),
array('mail', 'email', 'allowEmpty' => false, 'on' => array('registration', '')),
array('mail', 'mail_exists', 'on' => array('registration')),
array('password', 'string', 'allowEmpty' => false, 'min' => 5, 'on' => array('registration')),
array('password_confirm', 'compare', 'compareField' => 'password', 'on' => array('registration')),
);
/**
* Определяем дополнительные правила валидации
*
* @param array|bool $aParam
*/
public function __construct($aParam = false)
{
$this->aValidateRules[] = array(
'password',
'string',
'allowEmpty' => false,
'min' => 5,
'on' => array('registration'),
'label' => $this->Lang_Get('auth.labels.password')
);
$this->aValidateRules[] = array(
'password_confirm',
'compare',
'compareField' => 'password',
'on' => array('registration'),
'label' => $this->Lang_Get('auth.registration.form.fields.password_confirm.label')
);
$sCaptchaValidateType = func_camelize('captcha_' . Config::Get('sys.captcha.type'));
if (Config::Get('module.user.captcha_use_registration')) {
$this->aValidateRules[] = array(
'captcha',
$sCaptchaValidateType,
'name' => 'user_signup',
'on' => array('registration'),
'label' => $this->Lang_Get('auth.labels.captcha_field')
);
}
if (Config::Get('general.login.captcha')) {
$this->aValidateRules[] = array(
'captcha',
$sCaptchaValidateType,
'name' => 'user_auth',
'on' => array('signIn'),
'label' => $this->Lang_Get('auth.labels.captcha_field')
);
}
parent::__construct($aParam);
}
/**
* Валидация пользователя
*

View file

@ -917,9 +917,10 @@ return array(
),
// Общие лэйблы
'labels' => array(
'login' => 'Логин',
'password' => 'Пароль',
'captcha' => 'Введите цифры и буквы',
'login' => 'Логин',
'password' => 'Пароль',
'captcha' => 'Введите цифры и буквы',
'captcha_field' => 'Каптча',
),
// Общие всплывающие сообщения
'notices' => array(

@ -1 +1 @@
Subproject commit d7b646d9afed8e42a1e29f9d7addda5fa169393d
Subproject commit f53b367fe1cd06ed972b3e414c676aa7c1dd1aea