Using Codeigniter, I can create a user authentication function. I have a function that I call to check the username / password is correct. The problem I am facing is that I do not want the code to display "Invalid Login" if no password is specified. He should read "Password required" or something like that.
I think I could not ask for a password, in this case an empty password will lead to an unsuccessful logging. However, I want to make sure that SQL injection does not occur.
$this->form_validation->set_rules('username','username','required|callback_authenticate');
$this->form_validation->set_rules('password','password','required');
$this->form_validation->set_message('authenticate','Invalid login. Please try again.');
authenticate function
function authenticate() {
return Current_User::checkLogin($this->input->post('username'),
$this->input->post('password'));
}
source
share