CodeIgniter Forums
"Too many redirects" Ion Auth - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: "Too many redirects" Ion Auth (/showthread.php?tid=1108)



"Too many redirects" Ion Auth - vertisan - 02-12-2015

Hello!

I creating login system with Ion Auth, I got this code:
PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
Main extends CI_Controller {

 function 
__construct() {

 
parent::__construct();
 
$this->load->library( array( 'ion_auth' ) );

 }

 public function 
index()
 {

 
$this->load->view'templates/main/header' );
 
$this->load->view'templates/main/navigation' );
 
$this->load->view'Home' );
 
$this->load->view'templates/main/footer' );

 } 
// END: index()

 
public function logowanie()
 {

 
$data $this->data['title'] = "Login";

 
$this->load->view'templates/main/header'$data );
 
$this->load->view'logowanie' );
 
$this->load->view'templates/main/footer' );

 if ( isset(
$_POST) ) {

 
$login $this->input->post'username' );
 
$password $this->input->post'password' );

 
$login_process $this->ion_auth->login$login$password );

 if ( 
$login_process ) {
 
redirect'panel' );
 } else {
 
redirect'main/logowanie' );
 }
 
 }
 } 
// END: logowanie()

 
public function logout()
 {
 
$logout $this->ion_auth->logout();
 
redirect('/''refresh');
 }


// END: class Panel

/* End of file Main.php */
/* Location: ./application/controllers/Main.php */ 

and i getting error: This webpage has a redirect loop | Too many redirects

Why?


RE: "Too many redirects" Ion Auth - tomlagard - 02-12-2015

What version of CI are you using?


RE: "Too many redirects" Ion Auth - vertisan - 02-12-2015

CodeIgniter 3.0 RC2


RE: "Too many redirects" Ion Auth - tomlagard - 02-12-2015

Check out

https://github.com/benedmunds/CodeIgniter-Ion-Auth

as there has been discussion of CI 3 and Ion-Auth


RE: "Too many redirects" Ion Auth - Avenirer - 02-12-2015

where is Panel controller? or the controller/method that you redirect to 'panel'?