- 로그인 시 세션 토큰 발급→회원 행(mb_session_token) 저장 - SessionGuardFilter(전역 before)로 매 요청 토큰 대조, 다르면 세션 무효화 후 로그인 이동 - DB 공유로 로컬·운영 등 서버 간에도 동작. 기존 로그인 세션은 재로그인 전까지 유지 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
50 lines
1.0 KiB
PHP
50 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class MemberModel extends Model
|
|
{
|
|
protected $table = 'member';
|
|
protected $primaryKey = 'mb_idx';
|
|
protected $returnType = 'object';
|
|
protected $useTimestamps = false;
|
|
protected $allowedFields = [
|
|
'mb_id',
|
|
'mb_passwd',
|
|
'mb_totp_secret',
|
|
'mb_totp_enabled',
|
|
'mb_name',
|
|
'mb_email',
|
|
'mb_phone',
|
|
'mb_lang',
|
|
'mb_level',
|
|
'mb_group',
|
|
'mb_lg_idx',
|
|
'mb_state',
|
|
'mb_regdate',
|
|
'mb_latestdate',
|
|
'mb_leavedate',
|
|
'mb_login_fail_count',
|
|
'mb_locked_until',
|
|
'mb_session_token',
|
|
];
|
|
|
|
/**
|
|
* mb_id로 회원 조회
|
|
*/
|
|
public function findByLoginId(string $mbId): ?object
|
|
{
|
|
return $this->where('mb_id', $mbId)->first();
|
|
}
|
|
|
|
/**
|
|
* mb_id 중복 여부
|
|
*/
|
|
public function isIdExists(string $mbId): bool
|
|
{
|
|
return $this->where('mb_id', $mbId)->countAllResults() > 0;
|
|
}
|
|
}
|