P2-19~21 지자체 수정/삭제, 비밀번호 변경, 로그인 5회 실패 lock
- P2-19: LocalGovernment edit/update/delete 추가, 목록에 수정/비활성 버튼 - P2-20: PasswordChange 컨트롤러 + View (현재 비밀번호 검증 후 변경) - P2-21: 로그인 5회 연속 실패 시 30분 lock - member 테이블에 mb_login_fail_count, mb_locked_until 컬럼 추가 - Auth::login에 lock 체크/실패 카운트 증가/성공 시 리셋 로직 - E2E 테스트 4개 전체 통과 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -95,5 +95,89 @@ class LocalGovernment extends BaseController
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('success', '지자체가 등록되었습니다.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 지자체 수정 폼 (P2-19)
|
||||
*/
|
||||
public function edit(int $id)
|
||||
{
|
||||
if (! $this->isSuperAdmin()) {
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('error', '지자체 수정은 super admin만 가능합니다.');
|
||||
}
|
||||
|
||||
$item = $this->lgModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('error', '지자체를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
return view('admin/layout', [
|
||||
'title' => '지자체 수정',
|
||||
'content' => view('admin/local_government/edit', ['item' => $item]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 지자체 수정 처리 (P2-19)
|
||||
*/
|
||||
public function update(int $id)
|
||||
{
|
||||
if (! $this->isSuperAdmin()) {
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('error', '지자체 수정은 super admin만 가능합니다.');
|
||||
}
|
||||
|
||||
$item = $this->lgModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('error', '지자체를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$rules = [
|
||||
'lg_name' => 'required|max_length[100]',
|
||||
'lg_sido' => 'required|max_length[50]',
|
||||
'lg_gugun' => 'required|max_length[50]',
|
||||
'lg_addr' => 'permit_empty|max_length[255]',
|
||||
'lg_state' => 'required|in_list[0,1]',
|
||||
];
|
||||
|
||||
if (! $this->validate($rules)) {
|
||||
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
|
||||
}
|
||||
|
||||
$this->lgModel->update($id, [
|
||||
'lg_name' => (string) $this->request->getPost('lg_name'),
|
||||
'lg_sido' => (string) $this->request->getPost('lg_sido'),
|
||||
'lg_gugun' => (string) $this->request->getPost('lg_gugun'),
|
||||
'lg_addr' => (string) $this->request->getPost('lg_addr'),
|
||||
'lg_state' => (int) $this->request->getPost('lg_state'),
|
||||
]);
|
||||
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('success', '지자체가 수정되었습니다.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 지자체 삭제 (P2-19)
|
||||
*/
|
||||
public function delete(int $id)
|
||||
{
|
||||
if (! $this->isSuperAdmin()) {
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('error', '지자체 삭제는 super admin만 가능합니다.');
|
||||
}
|
||||
|
||||
$item = $this->lgModel->find($id);
|
||||
if ($item === null) {
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('error', '지자체를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$this->lgModel->update($id, ['lg_state' => 0]);
|
||||
|
||||
return redirect()->to(site_url('admin/local-governments'))
|
||||
->with('success', '지자체가 비활성화되었습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user