From 449f46e253b5d3ee311a2af6f44a394b9a18b1dd Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Tue, 10 Jul 2012 13:46:45 -0400 Subject: [PATCH] TPAC LDAP: include loc(g) param in login form The "loc" CGI param has largely been supplanted by the "locg" CGI param. In addition, we need to pass that parameter as part of the login credentials, otherwise we always get the tip of the org_unit tree. There may be other parameters we need to consider, as changing the search location does not necessarily reflect the home library of the user in question. Perhaps a better approach would be to define a value in config.tt2 that gets used here, so that sites with multiple skins & corresponding authentication proxy setups can just configure config.tt2 on a per-skin basis rather than having to override the entire login form.tt2? Sprinkle some timelog messages around for the sake of checking performance and debugging parameters. Signed-off-by: Dan Scott --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 13 +++++++++---- Open-ILS/src/templates/opac/parts/login/form.tt2 | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 02b55bc619..0e34b839d2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -327,11 +327,13 @@ sub load_login { my $cgi = $self->cgi; my $ctx = $self->ctx; + $self->timelog("Load login begins"); + $ctx->{page} = 'login'; my $username = $cgi->param('username'); my $password = $cgi->param('password'); - my $org_unit = $cgi->param('loc') || $ctx->{aou_tree}->()->id; + my $org_unit = $cgi->param('locg') || $cgi->param('loc') || $ctx->{aou_tree}->()->id; my $persist = $cgi->param('persist'); # initial log form only @@ -344,7 +346,9 @@ sub load_login { 'open-ils.auth_proxy.enabled'); } catch Error with {}; - my $args = { + $self->timelog("Checked for auth proxy: $auth_proxy_enabled; org = $org_unit; username = $username"); + + my $args = { type => ($persist) ? 'persist' : 'opac', org => $org_unit, agent => 'opac' @@ -367,14 +371,15 @@ sub load_login { 'open-ils.auth', 'open-ils.auth.authenticate.init', $username); $args->{password} = md5_hex($seed . md5_hex($password)); - $response = $U->simplereq( + $response = $U->simplereq( 'open-ils.auth', 'open-ils.auth.authenticate.complete', $args); } else { $args->{password} = $password; - $response = $U->simplereq( + $response = $U->simplereq( 'open-ils.auth_proxy', 'open-ils.auth_proxy.login', $args); } + $self->timelog("Checked password"); if($U->event_code($response)) { # login failed, report the reason to the template diff --git a/Open-ILS/src/templates/opac/parts/login/form.tt2 b/Open-ILS/src/templates/opac/parts/login/form.tt2 index 48f2f67982..2c393073cc 100644 --- a/Open-ILS/src/templates/opac/parts/login/form.tt2 +++ b/Open-ILS/src/templates/opac/parts/login/form.tt2 @@ -70,6 +70,7 @@
+