PEAR::Auth CVS -> problem with login function

From: Date: Fri, 05 Dec 2003 13:23:42 +0000
Subject: PEAR::Auth CVS -> problem with login function
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24198@lists.php.net to get a copy of this message
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

« previous php.pear.dev (#24198) next »