I have a login function in CodeIgniter with this code:
public function login() {
$this->redirect_if_logged($this->login_check());
$this->data['active'] = 'login';
$this->load->model('user_model');
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback__validate_login');
if (!$this->form_validation->run()) {
$this->load->template('login', $this->data);
} else {
redirect('/','refresh');
}
}
And a validation function:
public function _validate_login($password) {
$this->form_validation->set_message('_validate_login', 'Invalid username or password');
return false;
}
The problem is that the custom function is never called, the validator always return true if all rules pass. The validator itself works, I checked it with other rules. It is just ignoring my custom function. What am I missing here?
_validate_logincallback function, please tryecho $password; die;$this->redirect_if_logged($this->login_check());is redirect page