rintaun

Untitled

Jan 23rd, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public function validateLogin($username, $password) {
  2.                 return (
  3.                         (!empty($username) || $this->invalidate('username', 'notempty')) && // username cannot be empty. throw an error if it is.
  4.                         (!empty($password) || $this->invalidate('password', 'notempty')) && // password cannot be empty. throw an error if it is.
  5.                         ($u = $this->findByUsername($username, 'password')) && // lookup the user by username
  6.                         isset($u['User']['password']) && // make sure the lookup was successful
  7.                         ($hash = $this->generateHash($username, $password)) && // generate the hash for the given username/password
  8.                         $u['User']['password'] == $hash // compare the hashes
  9.                 );
  10.         }
Advertisement
Add Comment
Please, Sign In to add comment