I'm trying to use the HTTP Authentication Adapter.
I can get it to work for a succcessful login, but I can't get it to work for a failed login. It has something to do with my validate code:
PHP Code:
$auth = $adapter->authenticate();
if (!$auth->isValid()) {
foreach ($auth->getMessages() as $message) {
echo "$message\n";
}
// $this->_redirect('error/error');
// die("You don't have access");
} else {
echo "you have access";
}
Seems simple, but it doesn't work. If I leave it as is and the person clicks the "Cancel" button, I get the messages generated from the foreach, but then it shows the rest of the page which the user shouldn't see, since they are not logged in. As you can see by my commented-out lines, I've tried a couple of approaches. The problem with both of these approaches (die and redirecting) is that it seems to somehow break the authentication. If either of these are used instead of being commented out, users don't get prompted for credentials, but instead the die or redirect automatically runs. In other words, if I uncomment the redirect, users get redirected to the error page and never get the chance to enter credentials.
Please help if you can.