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