• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Login Validation

#1
[eluser]Unknown[/eluser]
Is there a cleaner way to use the Validation class to check two fields to see if they are valid together?

At the moment I do something like the following:
Code:
$rules['username'] = 'trim|required';
$rules['password'] = 'trim|required|callback__check_combo|sha1';

function _check_combo($val)
{
  // There are some DB calls usually but for the sake of
  // simplicity im just going to type it out
  if ($this->input->post('username') == 'bob' && sha1($val) == 'cow')
    return TRUE;

  return FALSE;
}

I was wondering if there was a cleaner way to do this? Because atm I'm trusting the the username validation will be done first. And other than that, if there is a problem with username, it will still call the _check_combo function (as it should), but I don't want it to work this way.

Thank you

#2
[eluser]Grahack[/eluser]
try to see if [url="http://ellislab.com/forums/viewthread/55818/"]this discussion[/url] is of any help


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.