[eluser]Fenix[/eluser]
I am having trouble understanding how I can call the flashdata from this particular function (the login function from the ReduxAuth library) in my view. Please take a look at how I'm doing this... what I don't understand is why in the library it's using $this->
ci->session-> but when I try to call it with that ci in there, it gives errors.
In the Library:
Code:
public function login ($email, $password)
{
# Grab hash, password, id, activation_code and banned_id from database.
$result = $this->_login($this->users_table, $this->banned_table, $email);
if ($result)
{
if(!empty($result->activation_code))
{
$this->ci->session->set_flashdata('login', 'Your Account is Not Activated.');
return 'NOT_ACTIVATED';
}
elseif(!empty($result->banned_id))
{
$this->ci->session->set_flashdata('login', 'Your Account has been banned for the following reason : '.$result->reason);
return 'BANNED';
}
else
{
$password = sha1($this->salt.$result->hash.$password);
if ($password === $result->password)
{
$this->ci->session->set_userdata(array('id'=> $result->id));
return true;
}
}
}
return false;
}
In my controller:
Code:
switch ($redux)
{
case 'NOT_ACTIVATED':
// Page Data
$data['page_title'] = 'Login - Not Activated';
$data['center_col'] = 'login_view';
$data['login_message'] = $this->session->flashdata('login');
$this->load->view('template_view',$data);
break;
case 'BANNED':
// Page Data
$data['page_title'] = 'Login - Banned';
$data['center_col'] = 'login_view';
$data['login_message'] = $this->session->flashdata('login');
$this->load->view('template_view',$data);
break;
case false:
// Page Data
$data['page_title'] = 'Login - Invalid Credentials';
$data['center_col'] = 'login_view';
$data['login_message'] = $this->session->flashdata('login');
$this->load->view('template_view',$data);
break;
case true:
redirect('admin/dashboard');
break;
}
In my view:
Code:
if(isset($login_message))
{
echo '<p>'.$login_message.'</p>';
}
I've also tried using just the $this->session->flashdata('login') in my view, that didnt work. Then I tried redirecting to users/login instead of just loading the views in each switch case, still no luck.
Please help me out! THanks!