What I guess what I do not understand is why it WILL show the error if im missing the username or password, because it will not pass the form_validation.
This is my function:
Code:
public function login()
{
// Set validation rules.
$this->form_validation->set_rules('login_identity', 'Identity (Email / Login)', 'required');
$this->form_validation->set_rules('login_password', 'Password', 'required');
// If failed login attempts from users IP exceeds limit defined by config file, validate captcha.
if ($this->flexi_auth->ip_login_attempts_exceeded())
{
$this->form_validation->set_rules('recaptcha_response_field', 'Captcha Answer', 'required|validate_recaptcha');
}
// Run the validation.
if ($this->form_validation->run())
{
// Check if user wants the 'Remember me' feature enabled.
$remember_user = ($this->input->post('remember_me') == 1);
// Save any public status or error messages (Whilst suppressing any admin messages) to CI's flash session data.
$this->session->set_flashdata('message', $this->flexi_auth->get_messages());
// Reload page, if login was successful, sessions will have been created that will then further redirect verified users.
redirect('account');
}
// Set validation errors.
$this->data['message'] = validation_errors('<p class="error_msg">', '</p>');