Using Codeigniter, I'm able to create a function for user authentication. I have a function that I call to check if the username/password given are valid. The problem I'm having is, I don't want the code to display "Invalid Login" if a password isn't given. It should read "Password is required" or something like that.
I guess I could NOT require the password field, in that case a blank password would result in a failed log in anyways. However, I want to make sure sql injection doesn't 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'));
}