문제

Kohana에서 인증 모듈을 구현하고 있으며이 오류 메시지의 소스를 파악할 수없는 것 같습니다. 데이터베이스에서 사용자를 생성하는 등록 양식을 제출할 때 발생합니다 (성공적으로 수행).

이 페이지의로드를 방지하는 오류가 감지되었습니다. 이 문제가 지속되면 웹 사이트 관리자에게 문의하십시오.

응용 프로그램/컨트롤러/register.php [83] :

정의되지 않은 속성 : register_controller :: $ auth

jQuery를 사용하여 양식을 검증하고 jQuery를 추가하기 전에 양식이 완벽하게 작동 했으므로 문제는 AJAX 요청과 관련이있을 수 있지만 어디로 가야할지 잘 모르겠습니다.

스택 추적은 다음과 같습니다.

   *

     Register_Controller->create_user(  )

   * system/core/Kohana.php [291]:

     ReflectionMethod->invokeArgs( Register_Controller Object
     (
         [template] => View Object
             (
                 [kohana_filename:protected] => /var/www/ko/testsite/system/views/form/template.php
                 [kohana_filetype:protected] => .php
                 [kohana_local_data:protected] => Array
                     (
                     )

             )

         [auto_render] => 1
         [uri] => URI Object
             (
             )

         [input] => Input Object
             (
                 [use_xss_clean:protected] => 1
                 [magic_quotes_gpc:protected] => 1
                 [ip_address] => 
             )

     )
      )

   *

     Kohana::instance(  )

   * system/core/Event.php [209]:

     call_user_func( Array
     (
         [0] => Kohana
         [1] => instance
     )
      )

   * system/core/Bootstrap.php [55]:

     Event::run( system.execute )

   * index.php [106]:

     require( system/core/Bootstrap.php )

그리고 register_controller의 create_user () 메소드는 다음과 같습니다.

public function create_user()
{
   if($_POST)
   {
      $post = $this->input->post();
      $user = ORM::factory('user');

      $user->add(ORM::factory('role', 'login'));

     if($user->validate($post, TRUE))
      {
         $this->auth->login($user, $post->password);
         url::redirect();
      }
      else
      {
         url::redirect('register');
      }
   }
}

누구든지 제안이 있습니까? :피

도움이 되었습니까?

해결책

당신이 얻는 오류는 컨트롤러에 변수 $ this-> 인증이 존재하지 않기 때문입니다.

나는 당신이해야 할 일을 추측하고 있습니다 $this->auth = Auth::instance(); 생성자에서.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top