addActionPaths(self::PATH); } abstract protected function login_process(): UserEntity; abstract protected function logout_process(): void; //로그인화면 public function login_form_process(): void {} final public function login_form(): string|RedirectResponse { $action = __FUNCTION__; try { //초기화 $this->action_init_process($action); $this->login_form_process(); $this->action_render_process($action); // dd($this->getViewDatas()); } catch (\Exception $e) { $this->addViewDatas(self::ACTION_RESULT, 'error'); $this->addViewDatas(self::ACTION_MESSAGE, $e->getMessage()); //오류발생시 리디렉션 대신 폼 뷰를 다시 렌더링하도록 action_view_process 호출 } return $this->action_result_process( $this->getActionPaths(), $action, $this->getViewDatas() ); } //로그인처리 final public function login(): RedirectResponse { $action = __FUNCTION__; try { $this->action_init_process($action); $this->login_process(); $redirect_url = $this->authService->popPreviousUrl() ?? implode(DIRECTORY_SEPARATOR, $this->getActionPaths()); return redirect()->to($redirect_url)->with('success', MESSAGES['LOGIN']); } catch (ValidationException $e) { // 검증 실패 시 폼으로 돌아가서 오류 메시지 표시 log_message('error', $e->getMessage()); return redirect()->back()->withInput()->with('errors', $e->getMessage()); } catch (\Exception $e) { log_message('error', $e->getMessage()); return redirect()->back()->withInput()->with('error', $e->getMessage()); // return redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $e->getMessage()); } } //로그아웃 final public function logout(): RedirectResponse { try { $this->logout_process(); // 홈페이지로 리다이렉트 $redirect_url = $this->authService->popPreviousUrl() ?? "/"; return redirect()->route($redirect_url)->with('error', MESSAGES['LOGOUT']); } catch (\Exception $e) { log_message("error", $e->getMessage()); return redirect()->back()->withInput()->with('error', "로그아웃 중 오류가 발생했습니다."); } } final protected function create_form_process(): void {} final protected function create_process(): RedirectResponse { return redirect()->to('/'); } final protected function modify_form_process($uid): void {} final protected function modify_process($uid): RedirectResponse { return redirect()->to('/'); } }