[eluser]The Revel[/eluser]
[quote author="CroNiX" date="1337033727"]Depends on your intention. Your original code was showing something that happened if it passed validation and something else if it didn't, so that's what my code was based on except it only does it if the form was submitted.[/quote]
I am so confused now LOL.
I have looked at the Login and change password functions in Ion Auth, and they follow the same thing I have
Code:
function login()
{
$this->data['title'] = "Login";
//validate form input
$this->form_validation->set_rules('identity', 'Identity', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == true)
{ //check to see if the user is logging in
//check for "remember me"
$remember = (bool) $this->input->post('remember');
if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))
{ //if the login is successful
//redirect them back to the home page
$this->session->set_flashdata('message', $this->ion_auth->messages());
redirect('account', 'refresh');
}
else
{ //if the login was un-successful
//redirect them back to the login page
$this->session->set_flashdata('message', $this->ion_auth->errors());
redirect('auth/login', 'refresh'); //use redirects instead of loading views for compatibility with MY_Controller libraries
}
}
else
{ //the user is not logging in so display the login page
//set the flash data error message if there is one
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
$this->data['identity'] = array('name' => 'identity',
'id' => 'username',
'type' => 'text',
'placeholder' => 'Email',
'value' => $this->form_validation->set_value('identity'),
);
$this->data['password'] = array('name' => 'password',
'id' => 'password',
'placeholder' => 'Password',
'type' => 'password',
);
//$this->load->view('auth/login', $this->data);
$this->template
->title( 'MyPrintCard.info', 'Login')
->set_layout('login')
->build('auth/login', $this->data);
}
}
And it does not show the Validation Errors.
Yet mine does.