Add option to log out of all other devices

This commit is contained in:
Kijin Sung 2021-01-20 23:15:07 +09:00
parent 2944bfc71a
commit e1fabe4242
5 changed files with 23 additions and 3 deletions

View file

@ -202,6 +202,7 @@ $lang->cmd_password_hashing_algorithm = 'Password Hashing Algorithm';
$lang->cmd_password_hashing_work_factor = 'Password Hashing Work Factor';
$lang->cmd_password_hashing_auto_upgrade = 'Auto-upgrade Hashing Algorithm';
$lang->cmd_password_change_invalidate_other_sessions = 'Log out other devices on password change';
$lang->cmd_login_invalidate_other_sessions = 'Log out other devices';
$lang->password_strength_low = 'low';
$lang->password_strength_normal = 'normal';
$lang->password_strength_high = 'high';
@ -210,6 +211,7 @@ $lang->about_password_hashing_algorithm = 'You can choose how to encrypt (hash)
$lang->about_password_hashing_work_factor = 'Higher work factors are more secure, but logins may take a long time. This only applies to bcrypt and pbkdf2.';
$lang->about_password_hashing_auto_upgrade = 'Passwords encrypted using different algorithms will be automatically converted to the configured algorithm at next login.';
$lang->about_password_change_invalidate_other_sessions = 'Log out all other devices (browsers) when a member changes the password.';
$lang->about_login_invalidate_other_sessions = 'Only allow login from one device. Previously used devices will be logged out automatically.';
$lang->about_password_strength['low'] = 'the password must be at least 4';
$lang->about_password_strength['normal'] = 'the password must be at least 6, and must have at least one alpha character and numeric characters';
$lang->about_password_strength['high'] = 'the password must be at least 8, and must have at least one alpha character, numeric character and special character ';

View file

@ -209,6 +209,7 @@ $lang->cmd_password_hashing_algorithm = '비밀번호 암호화 알고리듬';
$lang->cmd_password_hashing_work_factor = '비밀번호 암호화 소요시간';
$lang->cmd_password_hashing_auto_upgrade = '알고리듬 자동 업그레이드';
$lang->cmd_password_change_invalidate_other_sessions = '비번 변경시 다른 기기 로그아웃';
$lang->cmd_login_invalidate_other_sessions = '다른 기기 로그아웃';
$lang->password_strength_low = '낮음';
$lang->password_strength_normal = '보통';
$lang->password_strength_high = '높음';
@ -217,6 +218,7 @@ $lang->about_password_hashing_algorithm = '회원들의 비밀번호를 DB에
$lang->about_password_hashing_work_factor = '시간이 오래 걸리는 알고리듬일수록 보안이 강하지만, 로그인이 오래 걸릴 수 있습니다. bcrypt 및 pbkdf2 알고리듬에만 적용됩니다.';
$lang->about_password_hashing_auto_upgrade = '설정된 알고리듬과 다른 방법으로 암호화된 비밀번호가 있으면 다음 로그인시 설정된 알고리듬으로 자동 변환합니다.';
$lang->about_password_change_invalidate_other_sessions = '비밀번호를 변경하면 현재 기기(브라우저)를 제외한 모든 로그인이 풀리도록 합니다.';
$lang->about_login_invalidate_other_sessions = '한 번에 하나의 기기에서만 로그인할 수 있도록 합니다.';
$lang->about_password_strength['low'] = '비밀번호는 4자 이상이어야 합니다.';
$lang->about_password_strength['normal'] = '비밀번호는 6자리 이상이어야 하며 영문과 숫자를 반드시 포함해야 합니다.';
$lang->about_password_strength['high'] = '비밀번호는 8자리 이상이어야 하며 영문과 숫자, 특수문자를 반드시 포함해야 합니다.';

View file

@ -491,8 +491,9 @@ class memberAdminController extends member
'enable_login_fail_report',
'max_error_count',
'max_error_count_time',
'login_invalidate_other_sessions',
'after_login_url',
'after_logout_url'
'after_logout_url',
);
if(!count($args->identifiers))

View file

@ -2447,7 +2447,6 @@ class memberController extends member
// Update the latest login time
$args->member_srl = $member_info->member_srl;
$output = executeQuery('member.updateLastLogin', $args);
self::clearMemberCache($args->member_srl);
// Check if there is recoding table.
@ -2507,9 +2506,17 @@ class memberController extends member
Rhymix\Framework\Session::setAutologinKeys(substr($random_key, 0, 24), substr($random_key, 24, 24));
}
}
// Log in!
Rhymix\Framework\Session::login($member_info->member_srl);
$this->setSessionInfo();
// Log out all other sessions if so configured.
if ($config->login_invalidate_other_sessions === 'Y')
{
Rhymix\Framework\Session::destroyOtherSessions($member_info->member_srl);
}
return $output;
}

View file

@ -43,6 +43,14 @@
<p class="x_help-block">{$lang->about_login_trial_limit}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_login_invalidate_other_sessions}</label>
<div class="x_controls">
<label for="login_invalidate_other_sessions_y" class="x_inline"><input type="radio" name="login_invalidate_other_sessions" id="login_invalidate_other_sessions_y" value="Y" checked="checked"|cond="$config->login_invalidate_other_sessions === 'Y'" /> {$lang->cmd_yes}</label>
<label for="login_invalidate_other_sessions_n" class="x_inline"><input type="radio" name="login_invalidate_other_sessions" id="login_invalidate_other_sessions_n" value="N" checked="checked"|cond="$config->login_invalidate_other_sessions !== 'Y'" /> {$lang->cmd_no}</label>
<p class="x_help-block">{$lang->about_login_invalidate_other_sessions}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="after_login_url">{$lang->after_login_url}</label>
<div class="x_controls">