Re: PEAR::Auth CVS -> problem with login function
| From: | Yavor Shahpasov | Date: | Sun, 07 Dec 2003 11:07:08 +0000 |
| Subject: | Re: PEAR::Auth CVS -> problem with login function | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-24224@lists.php.net to get a copy of this message | ||
This has been added to cvs
Yavor
Jeroen Houben wrote:
Hi, I saw that a new method was added in CVS: failedLoginCallback() This seems usefull. The callback function will usually be interested in the $auth->status property but that only gets set *after* the callback function has been called. Here's a slightly changed version of the method, it seems to work. /*** Login function * * @access private * @return void */function login() {$login_ok = false;/** * When the user has already entered a username, * we have to validate it. */ if (!empty($this->username)) { if (true === $this->storage->fetchData($this->username, $this->password)) { $login_ok = true; } else { if (is_callable($this->loginFailedCallback)) { $this->status = AUTH_WRONG_LOGIN; call_user_func($this->loginFailedCallback,$this->username, $this); } } }if (!empty($this->username) && $login_ok) { $this->setAuth($this->username); if (is_callable($this->loginCallback)) { call_user_func($this->loginCallback,$this->username, $this); } }/** * If the login failed or the user entered no username, * output the login screen again. */ if ((empty($this->username) || !$login_ok) && $this->showLogin) { $this->drawLogin($this->storage->activeUser); return; }} HTH jeroen