Re: [cllfst] conference

[ Thread Index | Date Index | More lists.tuxfamily.org/cllfst Archives ]


This is how i solved it. now i have anonymous user neither by creating that anonymous user nor having two separate urls for the authentication:

function authenticate() {

if (!isset($_SERVER['PHP_AUTH_USER']);) {

         $this->setHeader();

     } else {

        $username = $_SERVER['PHP_AUTH_USER'];
        $password = $_SERVER['PHP_AUTH_PW'];
        $user = new User()->login($username, $password);

        // if the user entered a wrong username or password
        // if blank the user is considered as anonymous
        if ($user->isAnonymous() && ($username || $password)) {

            $this->setHeader();

       } else {

            return $user;

        }
    }

}

function setHeader() {

    header('WWW-Authenticate: Basic realm="My Realm"');
    header('HTTP/1.0 401 Unauthorized');
    // text returned when user hit cancel
    echo $GLOBALS['Language']->getText('plugin_webdav_common', 'authentication_required');
    die();

}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/