From 3670571e47fba3dc38aeec11a5f73ddc6cbea0ce Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Tue, 24 Jul 2012 12:39:49 -0400 Subject: [PATCH] TPAC: Fix org_unit location detection for login The TPAC login function currently looks for a 'loc' param to pass to the login service. This isn't right because: A. 'loc' is a search-related param, and shouldn't affect logins B. The login form doesn't actually pass through the 'loc' param C. The 'loc' param has been more or less replaced by 'locg' No, this isn't multiple choice, it's all of the above. Our best option at this point is to use the 'physical_loc' value instead. This matches what was done in JSPAC (though it was called 'ol' for "original location" back then). Finally, this commit is 95% the work of Dan Scott, including the additions of logging info and a few whitespace fixes. Signed-off-by: Dan Wells Signed-off-by: Dan Scott --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 13 +++++++++---- 1 file changed, 9 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 af25ecd204..64903e990f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -339,11 +339,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 = $ctx->{physical_loc} || $ctx->{aou_tree}->()->id; my $persist = $cgi->param('persist'); # initial log form only @@ -356,7 +358,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' @@ -379,14 +383,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 -- 2.11.0