아이디 저장 추가 #33
@@ -8,7 +8,7 @@ use CodeIgniter\Controller;
|
||||
|
||||
abstract class BaseController extends Controller
|
||||
{
|
||||
protected $helpers = ['array', 'function'];
|
||||
protected $helpers = ['array', 'function', 'cookie'];
|
||||
|
||||
protected $session;
|
||||
protected $data = [];
|
||||
|
||||
@@ -15,7 +15,12 @@ class Login extends BaseController
|
||||
|
||||
public function index(): string
|
||||
{
|
||||
return view('pages/login');
|
||||
$user_id = get_cookie('save_id');
|
||||
if (!empty($user_id)) {
|
||||
$this->data['user_id'] = $user_id;
|
||||
}
|
||||
|
||||
return view('pages/login', $this->data);
|
||||
}
|
||||
|
||||
// 로그인
|
||||
@@ -63,6 +68,7 @@ class Login extends BaseController
|
||||
* ------------------------------------*/
|
||||
$userId = $this->request->getPost('user_id');
|
||||
$userPw = $this->request->getPost('user_pw');
|
||||
$saveId = $this->request->getPost('saveId');
|
||||
|
||||
$this->loginModel = new LoginModel();
|
||||
$user = $this->loginModel->getUserByIdPw($userId, $userPw);
|
||||
@@ -111,6 +117,14 @@ class Login extends BaseController
|
||||
'logged_in' => true
|
||||
];
|
||||
|
||||
// 아이디 저장
|
||||
if (!empty($saveId)) {
|
||||
if ($saveId === "Y") {
|
||||
$period = 60 * 60 * 24 * 90;
|
||||
set_cookie('save_id', $userId, $period);
|
||||
}
|
||||
}
|
||||
|
||||
$logs['results'] = 1;
|
||||
$logs['usr_sq'] = $user['usr_sq'];
|
||||
$logs['reason'] = '로그인 성공';
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
<form class="" id="frm_login_info">
|
||||
<div class="form-floating mb-4">
|
||||
<input name="user_id" id="user_id" placeholder="아이디 입력" type="text"
|
||||
value="<?= $user_id ?? '' ?>"
|
||||
class="form-control form-control-lg border-0 shadow-sm"
|
||||
style="border-radius: 16px; background: rgba(248, 250, 252, 0.8); height: 58px;">
|
||||
<label for="user_id" class="text-muted">
|
||||
@@ -101,9 +102,11 @@
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div class="form-check">
|
||||
<input name="check" id="exampleCheck" type="checkbox"
|
||||
class="form-check-input" style="transform: scale(1.2);">
|
||||
<label for="exampleCheck"
|
||||
<input id="saveId" name="saveId" type="checkbox" class="form-check-input"
|
||||
style="transform: scale(1.2);" value="Y" <?php if (!empty($user_id)) {
|
||||
echo "checked";
|
||||
} ?>>
|
||||
<label for="saveId"
|
||||
class="form-check-label text-muted fw-medium">아이디저장</label>
|
||||
</div>
|
||||
<a onclick="faxOpen();" class="text-primary text-decoration-none fw-semibold">
|
||||
|
||||
Reference in New Issue
Block a user