2016-03-23 10 views
0

codeigniter(https://github.com/benedmunds/CodeIgniter-Ion-Auth)にion-auth "library"を使用していますが、flashdataに問題があります。これは、コードのsumaryです:セッションのデータがフォームに送信されない

public function reset_password($code = NULL) 
{ 
    if (!$code)show_404(); 
    $this->user = $this->ion_auth->forgotten_password_check($code); 
    if ($this->user) 
    { 
     //setting the rules 
     if ($this->form_validation->run() == false) 
     { 
      //more code 
      $this->_get_csrf_nonce(); 
      /* 
       One of the things this function (_get_csrf_nonce) makes is: 
       $this->session->set_flashdata('csrfkey', $key); 
       $this->session->set_flashdata('csrfvalue', $value); 
      */ 
      //The next thing is load the view with the form 
     } 
     else //form is running 
     { 
      echo "flashdata csrfkeyvalue: ".$this->session->flashdata('csrfvalue')."<br>"; 
      die; 
      //more code, but not important by the moment 
     } 
    } 
} 

まあ、ます$ this-のエコー>セッション - > flashdata( 'csrfvalue')フォームがオールウェイズsubmitedされたときに何も表示しません。それが動作する...この場合

private function _get_csrf_nonce(){ 
    /*$this->load->helper('string'); 
    $key = random_string('alnum', 8); 
    $value = random_string('alnum', 20); 
    $this->session->set_flashdata('csrfkey', $key);*/ 
    $this->session->set_flashdata('csrfvalue', $value); 
    redirect(base_url("auth/test")); 
    //return array($key => $value); 
} 
public function test() 
{ 
    echo "flashdata csrfkeyvalue: ".$this->session->flashdata('csrfvalue')."<br>"; 
} 


は、私のような何かを作る場合。フォームに使用しているビューは、これと非常によく似ています。https://github.com/benedmunds/CodeIgniter-Ion-Auth/blob/2/views/auth/reset_password.php

ありがとうございます。

答えて

0

SOLUTION

少しの戦いの後、私がロードされたフォームのビュー間の新たな要求を作ることができる何かを探していましたし、フォームが送信されたこと...最後に、私は発見(私はしなかった覚えています)コントローラーからリクエストされたjavascript(このチュートリアルに基づいていくつかのテキストを翻訳する:http://www.student.kuleuven.be/~r0304874/blog/international-javascript-files-in-codeigniter.html)。私はこのようにロードされました:

<script src="<?=site_url('jsloader/login.js');?>" type="text/javascript"></script> 

ありがとう。

関連する問題