2015-01-10 69 views
0

我想將Ion Auth集成到我的bootstrap登錄中,這是一種模式,我使用的是Code Igniter。當點擊登錄按鈕時,我如何調用Ion Auth的登錄方法?如果我使用重定向不會重新加載頁面並刪除模態?Ion Auth和Bootstrap Modals

我可以用onclick調用控制器嗎?或從控制器把登錄(),並把它作爲JavaScript?哈哈

真的需要幫助!

回答

0

你需要創建一個新控制器的方法登錄通過Ajax

0

我使用離子驗證使用CodeIgniter調用登錄功能,形成每一個控制器。例如:

<?php 

class Files extends CI_Controller { 

    function __construct() 
    { 
     parent::__construct(); 
     $this->load->model('files'); //to load your model 

     if (!$this->ion_auth->logged_in()) 
     { 
      redirect("auth/login", 'refresh'); //if you are not logged go to controller auth, function login to show the login form 
     } 
    } 

    function index() 
    { 
     //do something - you are already logged 
    } 

    ///here your functions in controller 

} 

..希望這可以幫助你。

+0

...對不起,現在我看到你已經要求一個可以使用bootstrap模式的解決方案。 – Tikky