TPAC LDAP: include loc(g) param in login form user/dbs/ldap_tpac
authorDan Scott <dscott@laurentian.ca>
Tue, 10 Jul 2012 17:46:45 +0000 (13:46 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 10 Jul 2012 17:48:10 +0000 (13:48 -0400)
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 <dscott@laurentian.ca>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/templates/opac/parts/login/form.tt2

index 02b55bc..0e34b83 100644 (file)
@@ -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
index 48f2f67..2c39307 100644 (file)
@@ -70,6 +70,7 @@
 <div>
     <div style="height:20px;"></div>
     <form method='POST'>
+        <input type='hidden' name='loc' value='[% CGI.param('locg') || CGI.param('loc') || ctx.search_ou %]'/>
         <table cellpadding="0" cellspacing="0" border="0">
             <tr>
                 <td valign="top" width="676" class="login_boxes left_brain">