Re: [Phplib-users] again auth.inc
Brought to you by:
nhruby,
richardarcher
|
From: Giancarlo P. <gia...@na...> - 2002-06-10 01:42:40
|
The auth->start logic IS very simple, we made it complicate in the past
for no reason.
It is more or less like this:
The user has valid auth[uid]?
if yes return UID.
The user has no auth[uid]?
if there he's provoding username+password lets' try to register him
if registration goes OK return UID
if there he's providing a username let's try to log him in
if login return true return UID
all other cases return false.
That's all folks!
Then the outer function, page_start, decides what to do, upon calling
$auth->start
If auth has returned false, we can decide either a global policy of
login/register forms for all cases, as phplib is now, with the same
full-blown login pages for the whole site
Otherwise set a global switch, or an $auth->auth[switch], that the very
particular pages can test and decide case by case what to do: show only
part of the content + a loginform somewhere, show a full blown, halting,
loginform, somewhere else, show exactly the same stuff to everyone + a
'welcome back my friend' in case he's authed, do nothing.
No more 'nobody', no more 'form' status, no more 'cancel_login', no more
unmaintainable code, no more limits and workaround on how and where to
show the forms, no more problems.
Hard?
G
|