Re: [Phplib-users] Default Auth? 7.2d
Brought to you by:
nhruby,
richardarcher
|
From: Jacob H. <Jac...@fi...> - 2002-02-14 19:42:12
|
Ah! After further testing...
It seems as thought having "nobody"-accessible links on your included
loginform file can't work. I'm using Fred's method.
If I access the other files directly, it works fine, but going through
the links on the loginform, it doesn't. Browsing the "default" page
(home.php, which is protected, so the loginform will display for
unauthenticated users) it turns out that I am correctly authenticated as
"nobody" initially. But since I've got an if_login() hook in there to
only allow authenticated users into home.php, if_login() nukes my
"nobody" auth info, which breaks the public links on the loginform.
So it seems the only solution is to use welcome.php as an outside
loginform (which would POST its login info to the protected page) and as
the default page...and use a simple no-nonsense login form for the
included loginform.
Hmmm...
>>> <fr...@on...> 02/13/02 02:41PM >>>
On Wed, Feb 13, 2002 at 11:05:03AM -0700, Jacob Hanson wrote:
> The Default Auth feature seems like it should do the trick, but it's
> not working. I've set library.php to use my default_auth subclass,
but
> I'm still getting the login page when I try to access library.php.
It doesn't work to use different Auth subclasses on different pages of
the same website. Whatever Auth subclass appears in the first
page_open() that the user visits will be the auth class for all pages
visited in the site while that session persists.
A common approach to allowing unrestricted access to some pages and
not others is to set up the application's Auth subclass to use
"default authentication" -- $auth->nobody == true -- and then force
login on restricted pages by using something like this right after
calling page_open():
$auth->login_if($auth->auth["uid"] == "nobody");
--
Fred Yankowski fr...@on... tel: +1.630.879.1312
OntoSys, Inc PGP keyID: 7B449345 fax: +1.630.879.1370
<A href="http://www.ontosys.com www.ontosys.com
38W242 Deerpath Rd, Batavia, IL 60510-9461, USA
|