Welcome Guest, Not a member yet? Register   Sign In
ion_auth login() does not return TRUE or FALSE.
#1

[eluser]dottedquad[/eluser]
$loginCheck = $this->ion_auth->login($identity, $password, $remember); $loginCheck is not returning TRUE or FALSE. I have no idea as to why something so simple like that is not working as I expected. For testing purposes I hard coded the values to see if there was an issue with my post values, but there doesn't seem to be since the view does echo back the post values when I tested them through an array. At some point I would like to check post values instead of hard coding the values.

There has to be something that I missed in the ion_auth's config or forgetting to include a helper or another library?

login.php controller code:

Code:
<?php
class Login extends CI_Controller
{
  function index()
  {
   $this->load->library('ion_auth');
  
   /*$identity = $this->input->post('email');
   $password = $this->input->post('password');
   $remember = $this->input->post('remember'); // remember the user*/
  
   $identity = "[email protected]";
   $password = "password";
   $remember = TRUE;
  
   $loginCheck = $this->ion_auth->login($identity, $password, $remember);
  
   $data['check'] = $loginCheck;
  
   $this->load->view('check', $data);
  }
}
?>

check.php view code:

Quote:<?php echo $check; ?>
#2

[eluser]Chathuranga Tennakoon[/eluser]
can you post the coding for your ion_auth model/library also. then i will be able to go through the whole coding and figure out what is actually happening.
#3

[eluser]dottedquad[/eluser]
For some strange reason the code is now working as expected after I changed my code. Perhaps my Hosting provider was slow with updating my files. Sometimes there is a delay after I upload a php or etc. file via ftp.

I changed:
Code:
$loginCheck = $this->ion_auth->login($identity, $password, $remember);
  
   $data['check'] = $loginCheck;
  
   $this->load->view('check', $data);

to:
Code:
if($this->ion_auth->login($identity, $password, $remember))
   {
    $messages = $this->ion_auth->messages();
    echo $messages;
   }
   else
   {
    $errors = $this->ion_auth->errors();
    echo $errors;
   }





Theme © iAndrew 2016 - Forum software by © MyBB