Bring the "IP check info" functionality to a working state
This commit is contained in:
parent
7802530f3d
commit
13be9d5300
6 changed files with 12 additions and 18 deletions
|
@ -161,14 +161,8 @@ class Auth extends Page
|
|||
if (! \password_verify($password, $user->password)) {
|
||||
$v->addError('Wrong user/pass');
|
||||
} else {
|
||||
// перезаписываем ip админа и модератора - Visman
|
||||
if (
|
||||
$user->isAdmMod
|
||||
&& $this->c->config->o_check_ip
|
||||
&& $user->registration_ip != $this->user->ip
|
||||
) {
|
||||
$user->registration_ip = $this->user->ip;
|
||||
}
|
||||
$this->c->users->updateLoginIpCache($user, true); // ????
|
||||
|
||||
// сбросить запрос на смену кодовой фразы
|
||||
if (32 === \strlen($user->activate_string)) {
|
||||
$user->activate_string = '';
|
||||
|
|
|
@ -79,7 +79,7 @@ class Config extends Profile
|
|||
$this->curUser->replAttrs($data, true);
|
||||
|
||||
if ($this->curUser->isModified('ip_check_type')) {
|
||||
// $this->c->users->updateLoginIpCache($this->curUser); // ????
|
||||
$this->c->users->updateLoginIpCache($this->curUser); // ????
|
||||
}
|
||||
|
||||
$this->c->users->update($this->curUser);
|
||||
|
|
|
@ -22,12 +22,12 @@ class Current extends Action
|
|||
if (! $user->isGuest) {
|
||||
if (! $cookie->verifyUser($user)) {
|
||||
$user = $this->load(1);
|
||||
} elseif (
|
||||
'1' == $this->c->config->o_check_ip
|
||||
&& $user->isAdmMod
|
||||
&& $user->registration_ip !== $user->ip
|
||||
) {
|
||||
$user = $this->load(1);
|
||||
} elseif ($user->ip_check_type > 0) {
|
||||
$hexIp = \bin2hex(\inet_pton($user->ip)); // ???? проверка на пустоту?
|
||||
|
||||
if (false === \strpos("|{$user->login_ip_cache}|", "|{$hexIp}|")) {
|
||||
$user = $this->load(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class UpdateLoginIpCache extends Action
|
|||
$hexIp = \bin2hex(\inet_pton($this->c->user->ip)); // ???? проверка на пустоту?
|
||||
|
||||
if (1 === $user->ip_check_type) {
|
||||
$ipStr = \str_replace("|{$hexIp}|", "|", "|{$user->login_ip_cache}|");
|
||||
$ipStr = \trim(\str_replace("|{$hexIp}|", "|", "|{$user->login_ip_cache}|"), '|');
|
||||
$ipStr = \trim("{$hexIp}|{$ipStr}", '|');
|
||||
|
||||
while (
|
||||
|
|
|
@ -547,4 +547,4 @@ msgid "Strict check"
|
|||
msgstr "Strict"
|
||||
|
||||
msgid "IP check info"
|
||||
msgstr "<b>Strict</b> - if your ip address has changed, you will be logout;<br><b>Not strict</b> - this board remembers 10-20 of your last ip addresses, if your current ip address is not in this list, you will be logout;<br><b>Off</b> - changing your ip address does not affect anything."
|
||||
msgstr "<b>Strict</b> - if your ip address has changed, you will be logout;<br><b>Not strict</b> - this board remembers 10-20 of your last ip addresses and if your current ip address is not in this list, you will be logout;<br><b>Off</b> - changing your ip address does not affect anything."
|
||||
|
|
|
@ -547,4 +547,4 @@ msgid "Strict check"
|
|||
msgstr "Строгая"
|
||||
|
||||
msgid "IP check info"
|
||||
msgstr "<b>Строгая</b> - при каждой смене вашего ip адреса, вы будите разлогинены;<br><b>Не строгая</b> - форум помнит 10-20 ваших последних ip адресов, если ваш текущий ip адрес не попадает в этот список, вы будите разлогинены;<br><b>Отключена</b> - смена вашего ip адеса ни на что не влияет."
|
||||
msgstr "<b>Строгая</b> - при каждой смене вашего ip адреса, вы будите разлогинены;<br><b>Не строгая</b> - форум помнит 10-20 ваших последних ip адресов и если ваш текущий ip адрес не попадает в этот список, вы будите разлогинены;<br><b>Отключена</b> - смена вашего ip адеса ни на что не влияет."
|
||||
|
|
Loading…
Add table
Reference in a new issue