mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-06-23 17:57:15 +09:00
Add IP exceptions to login failure counting config
This commit is contained in:
parent
20c57fc563
commit
180aa6f434
6 changed files with 36 additions and 14 deletions
|
|
@ -316,6 +316,7 @@ $lang->change_password_date = 'Password renewal cycle';
|
|||
$lang->about_change_password_date = 'If you set a value to this, you will be notified to change your password periodically. (If set to 0, disabled)';
|
||||
$lang->msg_change_password_date = 'You have not changed the password during %s days. For personal information protection, you need to change the password.';
|
||||
$lang->about_login_trial_limit = 'Limit the number of login attempts in a short time from the same IP address.';
|
||||
$lang->about_login_failure_except_ip = 'You can specify IP addresses or ranges that are exempt from the login attempt limit.<br>Enter one IP address or range per line.';
|
||||
$lang->msg_kr_address = 'Search for the name of eup, myeon or dong of your address.';
|
||||
$lang->msg_kr_address_etc = 'Enter the rest of your address.';
|
||||
$lang->cmd_search_again = 'Search again';
|
||||
|
|
@ -381,6 +382,7 @@ $lang->group = 'Group';
|
|||
$lang->retrieve_password = 'Retrieve password';
|
||||
$lang->excess_ip_access_count = 'There were too much login attempts from your device in a short time. You can not log in for %s.';
|
||||
$lang->enable_login_fail_report = 'Login failure';
|
||||
$lang->login_failure_except_ip = 'Login failure except IP';
|
||||
$lang->login_fail_report = 'Login failure report.';
|
||||
$lang->login_fail_report_contents = '<h2>There is recorded login failures.</h2>%1$s<hr /><p>* This notification is shown once.<br />* This message contains login failure records, before a ID login success.<br />Sending: %2$s</p>';
|
||||
$lang->all_group = 'Entire Group';
|
||||
|
|
|
|||
|
|
@ -319,7 +319,8 @@ $lang->msg_invalid_symbol_in_nickname = '닉네임에 사용할 수 없는 특
|
|||
$lang->change_password_date = '비밀번호 갱신주기';
|
||||
$lang->about_change_password_date = '일정 기간이 지나면 비밀번호를 변경하도록 유도하는 기능입니다. 사용하지 않으려면 0을 입력하십시오.';
|
||||
$lang->msg_change_password_date = '%s일 동안 비밀번호를 변경하지 않았습니다. 개인정보 보호를 위하여 비밀번호를 변경해야 합니다.';
|
||||
$lang->about_login_trial_limit = '짧은 시간 동안 하나의 아이피(IP)에서 시도할 수 있는 로그인 횟수에 제한을 둡니다.';
|
||||
$lang->about_login_trial_limit = '짧은 시간 동안 하나의 IP에서 시도할 수 있는 로그인 횟수에 제한을 둡니다.';
|
||||
$lang->about_login_failure_except_ip = '로그인 횟수 제한에서 예외로 할 IP 주소 또는 대역을 지정할 수 있습니다.<br>IP 주소 또는 대역을 한 줄에 하나씩 입력하세요.';
|
||||
$lang->msg_kr_address = '읍, 면, 동 이름으로 검색하세요.';
|
||||
$lang->msg_kr_address_etc = '나머지 주소(번지)를 입력하세요.';
|
||||
$lang->cmd_search_again = '다시 검색';
|
||||
|
|
@ -384,7 +385,8 @@ $lang->msg_success_modify_email_address = '이메일 주소가 정상적으로
|
|||
$lang->group = '그룹';
|
||||
$lang->retrieve_password = '비밀번호 찾기';
|
||||
$lang->excess_ip_access_count = '로그인 가능 횟수를 초과했습니다. %s 간 로그인할 수 없습니다.';
|
||||
$lang->enable_login_fail_report = '계정 무한 대입 방지 사용';
|
||||
$lang->enable_login_fail_report = '계정 무한 대입 방지';
|
||||
$lang->login_failure_except_ip = '로그인 횟수 예외 IP';
|
||||
$lang->login_fail_report = '로그인 실패 기록 보고 입니다.';
|
||||
$lang->login_fail_report_contents = '<h2>로그인 실패 기록을 알려드립니다.</h2>%1$s<hr /><p>* 비밀번호를 틀리는 등의 일이 없었는데 이 메시지를 보신다면, 계정 관리에 유의 바랍니다.<br />* 이 메시지는 로그인이 성공한 순간 누적 로그인 실패 기록이 많을 경우, 로그인 성공 이전 실패 기록을 모아서 발송합니다.<br />발송 시각: %2$s</p>';
|
||||
$lang->all_group = '그룹전체';
|
||||
|
|
|
|||
|
|
@ -596,6 +596,7 @@ class MemberAdminController extends Member
|
|||
'enable_login_fail_report',
|
||||
'max_error_count',
|
||||
'max_error_count_time',
|
||||
'login_failure_except_ip',
|
||||
'login_invalidate_other_sessions',
|
||||
'after_login_url',
|
||||
'after_logout_url'
|
||||
|
|
@ -640,6 +641,14 @@ class MemberAdminController extends Member
|
|||
$args->change_password_date = 0;
|
||||
}
|
||||
|
||||
if($args->login_failure_except_ip)
|
||||
{
|
||||
$args->login_failure_except_ip = array_map('trim', explode("\n", $args->login_failure_except_ip));
|
||||
$args->login_failure_except_ip = array_filter($args->login_failure_except_ip, function($val) {
|
||||
return $val !== '';
|
||||
});
|
||||
}
|
||||
|
||||
if(!trim(strip_tags($args->after_login_url)))
|
||||
{
|
||||
$args->after_login_url = NULL;
|
||||
|
|
|
|||
|
|
@ -2642,20 +2642,21 @@ class MemberController extends Member
|
|||
$args = new stdClass;
|
||||
$args->ipaddress = \RX_CLIENT_IP;
|
||||
$output = executeQuery('member.getLoginCountByIp', $args);
|
||||
$errorCount = $output->data->count;
|
||||
if($errorCount >= $config->max_error_count)
|
||||
if ($output->data->count >= $config->max_error_count)
|
||||
{
|
||||
$last_update = strtotime($output->data->last_update);
|
||||
$term = intval($_SERVER['REQUEST_TIME']-$last_update);
|
||||
if($term < $config->max_error_count_time)
|
||||
$last_update = ztime($output->data->last_update);
|
||||
$term = intval(\RX_TIME - $last_update);
|
||||
if ($term < $config->max_error_count_time)
|
||||
{
|
||||
$term = $config->max_error_count_time - $term;
|
||||
if($term < 60) $term = intval($term).lang('unit_sec');
|
||||
elseif(60 <= $term && $term < 3600) $term = intval($term/60).lang('unit_min');
|
||||
elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).lang('unit_hour');
|
||||
else $term = intval($term/86400).lang('unit_day');
|
||||
|
||||
return new BaseObject(-1, sprintf(lang('excess_ip_access_count'), $term));
|
||||
if (!$config->login_failure_except_ip || !Rhymix\Framework\Filters\IpFilter::inRanges(\RX_CLIENT_IP, $config->login_failure_except_ip))
|
||||
{
|
||||
$term = $config->max_error_count_time - $term;
|
||||
if($term < 60) $term = intval($term).lang('unit_sec');
|
||||
elseif(60 <= $term && $term < 3600) $term = intval($term/60).lang('unit_min');
|
||||
elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).lang('unit_hour');
|
||||
else $term = intval($term/86400).lang('unit_day');
|
||||
return new BaseObject(-1, sprintf(lang('excess_ip_access_count'), $term));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ class MemberModel extends Member
|
|||
$config->enable_login_fail_report = $config->enable_login_fail_report ?? 'Y';
|
||||
$config->max_error_count = $config->max_error_count ?? 10;
|
||||
$config->max_error_count_time = $config->max_error_count_time ?? 300;
|
||||
$config->login_failure_except_ip = $config->login_failure_except_ip ?? [];
|
||||
$config->login_invalidate_other_sessions = $config->login_invalidate_other_sessions ?? 'N';
|
||||
$config->after_login_url = $config->after_login_url ?? null;
|
||||
$config->after_logout_url = $config->after_logout_url ?? null;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@
|
|||
<p class="x_help-block">{$lang->about_login_trial_limit}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="login_failure_except_ip">{$lang->login_failure_except_ip}</label>
|
||||
<div class="x_controls">
|
||||
<textarea id="login_failure_except_ip" name="login_failure_except_ip">{implode("\n", $config->login_failure_except_ip ?? [])}</textarea>
|
||||
<p class="x_help-block">{$lang->about_login_failure_except_ip}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->cmd_login_invalidate_other_sessions}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue