The last thing we do is check that either there is a valid
login or guest users are allowed to use this application. You may
not always want to allow guest users.
<?php
// Redirect the user to the Horde login page if they haven't authenticated. if (!Auth::getAuth() && !$registry->allowGuests()) { header('Location: ' . Horde::url($registry->getParam('webroot', 'horde') . '/login.php?url=' . urlencode(Horde::selfUrl()), true)); echo "\n"; exit; }
?>
- Auth::getAuth() returns the current user or false if no one is logged in.
- $registry->allowGuests() checks if the current application has been configured to allow guest users.
- If these checks are failed, redirect to the Horde login page and exit. If there is a custom login page, the Horde login page will take care of redirecting to/loading it.
- Some WAP clients seem not to like redirects without an extra newline after them.
|