service === null) { $this->service = service('googleauth'); } $this->addActionPaths(self::PATH); } protected function action_init_process(string $action): void { parent::action_init_process($action); $fields = ['access_code']; $filters = []; switch ($action) { case 'login': case 'login_form': break; default: throw new \Exception("지원하지 않는 action입니다.({$action})"); // break; } $this->addViewDatas('helper', $this->service->getHelper()); $this->addViewDatas('formFields', $this->service->getFormService()->getFormFields($action, $fields)); $this->addViewDatas('formFilters', $this->service->getFormService()->getFormFilters($action, $filters)); $this->addViewDatas('formRules', $this->service->getFormService()->getFormRules($action, $fields)); $this->addViewDatas('formOptions', $this->service->getFormService()->getFormOptions($action, $filters)); } public function login_form_process(): void { //구글 로그인 BUTTON용 $this->addViewDatas('SNSButton', anchor($this->service->socket->createAuthUrl(), ICONS['GOOGLE'] . 'Google 로그인', ["class" => "btn-google"])); } //로그인처리 protected function login_process(): UserEntity { //요청 데이터를 DTO 객체로 변환 $dto = new GoogleDTO($this->request->getPost()); return $this->service->login($dto); } protected function logout_process(): void { $this->service->logout(); } }