Hi Everyone, I have just commited into the main branch the substantially rewritten Auth.pm authentification module from the rel-1-2 branch (as in use at HLT). The biggest change is the get_template_and_user () sub. This combines a whole lot of code that I had at the top of every script. It gets the correct template, and authenticates the user, loading the users details into the template (in a loop variable USER_INFO). This means that you dont need to "use C4::Output;" in the scripts, just "use C4::Auth;" In addition I have put in some code that checks the systempreferences for a "timeout" time in seconds, otherwise it defaults to 120 sec (2 mins). The login prompt is now templated as well (important for new opac). This is found at opac-auth.tmpl for the opac and auth.tmpl for the intranet. It uses Context as all good main branch modules and scripts should. It also uses Output to get the template objects. It uses Circulation::Circ2 to get the borrower information which is a little weird. It would be good to have a Users.pm module that Circ and everything else could use that accessed all the users information and returned it in a uniform way. Maybe even OO? Anyway, thats the new Auth.pm Finlay
Finlay Thompson a écrit:
Hi Everyone,
The login prompt is now templated as well (important for new opac). This is found at opac-auth.tmpl for the opac and auth.tmpl for the intranet.
I can't find auth.tmpl neither in 1,2 nor in head. didn't you forget something ?
It uses Circulation::Circ2 to get the borrower information which is a little weird. It would be good to have a Users.pm module that Circ and everything else could use that accessed all the users information and returned it in a uniform way. Maybe even OO?
good idea. -- Paul POULAIN Consultant indépendant en logiciels libres responsable francophone de koha (SIBGB libre http://fr.koha.org)
Hey Paul, thanks for fixing the bug in Output.pm and putting auth.tmpl into the intranet path :-) At the moment it is necessary to pass $type = 'intranet' | 'opac' argument to the Auth::get_template_and_user() sub. This is kind of annoying though. It would be nice if there was some way that Auth would know whether it was being called from the opac or the intranet. Perhaps there is a $ENV variable that says what the site root directory is? That way we could get away from having the whole $type thing. It is ugly! At the moment we have: my $htdocs; if ($opac ne "intranet") { $htdocs = C4::Context->config('opachtdocs'); } else { $htdocs = C4::Context->config('intrahtdocs'); } It would be better as: my $htdocs = $ENV{'WEB_ROOT'}; or what ever that variable is :-) The in Output.pm we could combine getemplate and themelanguage, get rud of pathtotemplate, and put it in Auth.pm. That way Output.pm could be put into the "modules that will eventually die" box because all of the other code in there is now handled by html::template. Finlay
In article <3DF6925F.7090702@katipo.co.nz>, Finlay Thompson <finlay@katipo.co.nz> wrote:
This is kind of annoying though. It would be nice if there was some way that Auth would know whether it was being called from the opac or the intranet. Perhaps there is a $ENV variable that says what the site root directory is? That way we could get away from having the whole $type thing. It is ugly!
I don't think there is such a thing (for the CGI interface, not Apache-specific). However, we do have $0, which is "almost guaranteed" to contain the full path of the script (so we would be able to deduce the site root directory); this, however, is not really guaranteed :-/ Or we can try getting the current directory; I believe it at least is under the correct site root directory. (My CGI scripts always look at $0. So far it seems that Apache, Roxen/Caudium, and IIS all set $0 more or less the way I expect it to, but I don't know how portable this really is.) -- Ambrose Li <a.c.li@ieee.org> http://ada.dhs.org/~acli/cmcc/ http://www.cccgt.org/ DRM is theft - We are the stakeholders
participants (3)
-
acli@ada.dhs.org via news-to-mail gateway -
Finlay Thompson -
paul POULAIN