i'm building an Api, i need to login in a codeigniter-restserver project with an email + password stored on my mysql database.
this what i tried so far:
in my REST_Controller i changed the _check_login
function with this:
$this->load->model('Model_logiin');
$valid_logins = $this->Model_logiin->get_by(array('student_id'=>$username));
please take a look at the complete code here : https://github.com/chriskacerguis/codeigniter-restserver my
Model Model_logiin is this:
class Model_logiin extends MY_Model{
protected $_table = 'students';
protected $primary_key = 'email_adress';
protected $return_type = 'array';
protected $after_get = array('remove_sensetive_data'); //specified in MY_Model class
protected function remove_sensetive_data($student){
unset($student['ip_adress']);
unset($student['student_id']);
...
return $student;
}
}
The Problem: in the login stage.. if i type anything i can login
** if you need more info please let me know
** if the best approach for an api to not login with email just API-Key also please let me know
** i'm new to codeigniter.