Use container->MAX_EMAIL_LENGTH

This commit is contained in:
Visman 2023-05-19 18:02:44 +07:00
parent f61f1d246a
commit 5923684775
9 changed files with 15 additions and 15 deletions

View file

@ -69,7 +69,7 @@ class Mail
{
if (
! \is_string($email)
|| \mb_strlen($email, 'UTF-8') > 80 // for DB
|| \mb_strlen($email, 'UTF-8') > $this->c->MAX_EMAIL_LENGTH
|| ! \preg_match('%^([^\x00-\x1F]+)@([^\x00-\x1F\s@]++)$%Du', $email, $matches)
) {
return false;

View file

@ -82,7 +82,7 @@ class Bans extends Admin
'token' => 'token:AdminBans',
'username' => 'string:trim,null|max:25',
'ip' => 'string:trim,null|max:40',
'email' => 'string:trim,null|max:80',
'email' => 'string:trim,null|max:' . $this->c->MAX_EMAIL_LENGTH,
'message' => 'string:trim,null|max:255',
'expire_1' => 'date',
'expire_2' => 'date',
@ -158,7 +158,7 @@ class Bans extends Admin
];
$fields['email'] = [
'type' => 'text',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'caption' => 'E-mail label',
'value' => $data['email'] ?? null,
];
@ -268,7 +268,7 @@ class Bans extends Admin
];
$fields['email'] = [
'type' => 'text',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'caption' => 'E-mail label',
'help' => 'E-mail help',
'value' => $data['email'] ?? null,
@ -643,7 +643,7 @@ class Bans extends Admin
'token' => 'token:' . $this->formBanPage,
'username' => $this->banCount < 1 ? 'string:trim|max:25|user_ban' : 'absent',
'ip' => $this->banCount < 2 ? 'string:trim,spaces|max:255|ip_ban' : 'absent',
'email' => $this->banCount < 2 ? 'string:trim|max:80|email_ban' : 'absent',
'email' => $this->banCount < 2 ? 'string:trim|max:' . $this->c->MAX_EMAIL_LENGTH . '|email_ban' : 'absent',
'message' => 'string:trim|max:255',
'expire' => 'date|expire_ban',
'submit' => 'required|submit_ban',

View file

@ -513,7 +513,7 @@ class Options extends Admin
'fields' => [
'o_admin_email' => [
'type' => 'email',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'value' => $config->o_admin_email,
'caption' => 'Admin e-mail label',
'help' => 'Admin e-mail help',
@ -522,7 +522,7 @@ class Options extends Admin
],
'o_webmaster_email' => [
'type' => 'email',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'value' => $config->o_webmaster_email,
'caption' => 'Webmaster e-mail label',
'help' => 'Webmaster e-mail help',

View file

@ -105,7 +105,7 @@ class NewUser extends Users
],
'email' => [
'type' => 'email',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'value' => $data['email'] ?? null,
'caption' => 'Email',
'help' => 'Email info',

View file

@ -63,7 +63,7 @@ class View extends Users
])->addRules([
'token' => 'token:AdminUsers',
'username' => 'string:null|max:25',
'email' => 'string:null|max:80',
'email' => 'string:null|max:' . $this->c->MAX_EMAIL_LENGTH,
'title' => 'string:null|max:50',
'realname' => 'string:null|max:40',
'gender' => 'integer|in:' . FORK_GEN_NOT . ',' . FORK_GEN_MAN . ',' . FORK_GEN_FEM,
@ -191,7 +191,7 @@ class View extends Users
];
$fields['email'] = [
'type' => 'text',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'caption' => 'E-mail address label',
'value' => $data['email'] ?? null,
];

View file

@ -74,7 +74,7 @@ class Auth extends Page
'redirect' => $this->c->Csrf->create('Index'),
'username' => $user->username,
'password' => $user->password,
'save' => null,
'save' => '1',
'login' => 'Login User model',
];
}
@ -369,7 +369,7 @@ class Auth extends Page
'email' => [
'autofocus' => true,
'type' => 'email',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'value' => $email,
'caption' => 'Email',
'help' => 'Passphrase reset info',

View file

@ -61,7 +61,7 @@ trait PostFormTrait
$fieldset['email'] = [
'class' => ['w2'],
'type' => 'email',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'caption' => 'Email',
'required' => 1 === $this->c->config->b_force_guest_email,
'pattern' => '.+@.+',

View file

@ -228,7 +228,7 @@ class Email extends Profile
'new_email' => [
'autofocus' => true,
'type' => 'email',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'caption' => $this->rules->confirmEmail ? 'New or old email' : 'New email',
'required' => true,
'pattern' => '.+@.+',

View file

@ -112,7 +112,7 @@ class Register extends Page
'autofocus' => true,
'class' => ['hint'],
'type' => 'email',
'maxlength' => '80',
'maxlength' => (string) $this->c->MAX_EMAIL_LENGTH,
'value' => $v->email,
'caption' => 'Email',
'help' => 'Email info',