Email validation constants moved to config
This commit is contained in:
parent
9f9f2e459a
commit
7d1de2129c
3 changed files with 13 additions and 12 deletions
|
@ -236,7 +236,9 @@ class Auth extends Page
|
|||
if ($isSent) {
|
||||
$tmpUser->activate_string = $key;
|
||||
$tmpUser->last_email_sent = \time();
|
||||
|
||||
$this->c->users->update($tmpUser);
|
||||
|
||||
return $this->c->Message->message(\ForkBB\__('Forget mail', $this->c->config->o_admin_email), false, 200);
|
||||
} else {
|
||||
return $this->c->Message->message(\ForkBB\__('Error mail', $this->c->config->o_admin_email), true, 200);
|
||||
|
|
|
@ -8,9 +8,6 @@ use ForkBB\Models\User\Model as User;
|
|||
|
||||
class Email extends Validators
|
||||
{
|
||||
const FLOOD = 3600;
|
||||
const LENGTH = 80;
|
||||
|
||||
/**
|
||||
* Проверяет email
|
||||
* WARNING!!!
|
||||
|
@ -29,7 +26,7 @@ class Email extends Validators
|
|||
if (null === $email) {
|
||||
return null;
|
||||
// проверка длины email в одном месте
|
||||
} elseif (\mb_strlen($email, 'UTF-8') > self::LENGTH) {
|
||||
} elseif (\mb_strlen($email, 'UTF-8') > $this->c->MAX_EMAIL_LENGTH) {
|
||||
$v->addError('Long email');
|
||||
return $email;
|
||||
// это не email
|
||||
|
@ -82,10 +79,10 @@ class Email extends Validators
|
|||
} elseif ($user instanceof User) {
|
||||
$flood = \time() - $user->last_email_sent;
|
||||
} else {
|
||||
$flood = self::FLOOD;
|
||||
$flood = $this->c->FLOOD_INTERVAL;
|
||||
}
|
||||
if ($flood < self::FLOOD) {
|
||||
$v->addError(\ForkBB\__('Email flood', (int) ((self::FLOOD - $flood) / 60)), 'e');
|
||||
if ($flood < $this->c->FLOOD_INTERVAL) {
|
||||
$v->addError(\ForkBB\__('Email flood', (int) (($this->c->FLOOD_INTERVAL - $flood) / 60)), 'e');
|
||||
$ok = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,21 +27,23 @@ return [
|
|||
'salt' => '_SALT_FOR_HMAC_',
|
||||
],
|
||||
'JQUERY_LINK' => '//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js',
|
||||
'DEBUG' => 2,
|
||||
'DEBUG' => 0,
|
||||
'MAINTENANCE_OFF' => false,
|
||||
'GROUP_ADMIN' => 1,
|
||||
'GROUP_MOD' => 2,
|
||||
'GROUP_GUEST' => 3,
|
||||
'GROUP_MEMBER' => 4,
|
||||
'BBCODE_INFO' => [
|
||||
'BBCODE_INFO' => [
|
||||
'forSign' => ['b', 'i', 'u', 'color', 'colour', 'email', 'img', 'url'],
|
||||
'smTpl' => '<img src="{url}" alt="{alt}">',
|
||||
'smTplTag' => 'img',
|
||||
'smTplBl' => ['url'],
|
||||
],
|
||||
'MAX_POST_SIZE' => 65536,
|
||||
'MAX_IMG_SIZE' => '2M',
|
||||
'MAX_FILE_SIZE' => '2M',
|
||||
'MAX_POST_SIZE' => 65536,
|
||||
'MAX_IMG_SIZE' => '2M',
|
||||
'MAX_FILE_SIZE' => '2M',
|
||||
'MAX_EMAIL_LENGTH' => 80,
|
||||
'FLOOD_INTERVAL' => 3600,
|
||||
|
||||
'shared' => [
|
||||
'DB' => [
|
||||
|
|
Loading…
Add table
Reference in a new issue