Delete unnecessary form validation error message

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'));
}
+3
source share
1 answer

, , , set_rules() :

$this- > form_validation- > set_rules ( '', '', ' | your_callback_function');

, required . , . . , , .

SQL- , sha1 md5 .

: .

, Active Record , , . SQL.

+1

Source: https://habr.com/ru/post/1732697/


All Articles