auth = $this->getDI()->get('auth'); } public function register() { $service = new RegisterService(); $account = $service->handle(); $userRepo = new UserRepo(); $user = $userRepo->findById($account->id); $this->auth->saveAuthInfo($user); return $user; } public function loginByPassword() { $post = $this->request->getPost(); $accountValidator = new AccountValidator(); $user = $accountValidator->checkUserLogin($post['account'], $post['password']); $captchaValidator = new CaptchaValidator(); $captchaValidator->checkCode($post['ticket'], $post['rand']); $this->auth->saveAuthInfo($user); } public function loginByVerify() { $post = $this->request->getPost(); $accountValidator = new AccountValidator(); $user = $accountValidator->checkVerifyLogin($post['account'], $post['verify_code']); $this->auth->saveAuthInfo($user); } public function logout() { $this->auth->clearAuthInfo(); } }