![]() |
Throwing a validation error when the username and password is incorrect - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Throwing a validation error when the username and password is incorrect (/showthread.php?tid=56947) |
Throwing a validation error when the username and password is incorrect - El Forum - 02-01-2013 [eluser]merik[/eluser] I am using form validation to show warning messages to the user when the username and password doesn't meet the required validation rules: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); This way, if the username is missing or password is too short, I show a warning message above the form: Code: <?php echo validation_errors('<div class="alert alert-error">','</div>'); ?> I was wondering if I could also throw a validation error when the username and password passes the rules, but don't match any record in the database. I can do it manually (by creating another DIV like the last one, and showing a message in it, when authentication fails), but I wonder if I can reuse the validation_errors() function for that. I thought of using callback functions, but they are only for single input fields, not a combination of username and password. Any idea? Throwing a validation error when the username and password is incorrect - El Forum - 02-02-2013 [eluser]Aken[/eluser] You can use $this->input->post() in your callback. Throwing a validation error when the username and password is incorrect - El Forum - 02-02-2013 [eluser]merik[/eluser] [quote author="Aken" date="1359795096"]You can use $this->input->post() in your callback.[/quote] Can you be more specific please? Or give an example. I'm not sure if I can understand your recommendation. Throwing a validation error when the username and password is incorrect - El Forum - 02-02-2013 [eluser]Aken[/eluser] You can use that method to retrieve POST values of other fields, not just the one sent to your callback. |