Re: [Phplib-users] again auth.inc
Brought to you by:
nhruby,
richardarcher
|
From: Giancarlo P. <gia...@na...> - 2002-06-10 09:07:09
|
Giancarlo Pinerolo wrote: > > 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 In this case, phplib works exactly as before. You can put the auth.inc in place an all your site continues to work as usual > 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. In this case you decide that you are not going to have a glonbal behaviour, but want to decide case by case. If you need the intermediate state, even in the same auth[uid] place, I can add it to page_open. When it shows the form it will set that, upon considering the input fields it will check that. And the whole auth->start code is much more clean, with exactly the same inner behavior, using exactly the same field. Jus moved to somewhere more readable and easily twicklable Gian > 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 |