--- /dev/null
+<div id="header" style="width:90%;">
+ <div class="float-left">
+ [% INCLUDE "opac/biblio/topnav_logo.tt2" %]
+ </div>
+ <div class="float-right">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td>
+ <img src="[% ctx.media_prefix %]/images/dash-corner-left1.png" />
+ </td>
+ <td id="dash_corner_mid1a">
+ <span id="dash_user">
+ [% l('[_1] [_2]', ctx.user.first_given_name, ctx.user.family_name) | html %]
+ </span>
+ </td>
+ <td id="dash_corner_mid1b">
+ <img src="[% ctx.media_prefix %]/images/dash-divider.jpg" />
+ </td>
+ <td id="dash_corner_mid1c">
+ <a href="[% ctx.opac_root %]/biblio/logout" class="pos-rel-top4"
+ id="logout_link"><img
+ alt="[% l('Logout') %]"
+ src="[% ctx.media_prefix %]/images/logout-btn.png"
+ onmouseover="this.src='[% ctx.media_prefix %]/images/logout-btn-hover.png';"
+ onmouseout="this.src='[% ctx.media_prefix %]/images/logout-btn.png';" /></a>
+ </td>
+ <td>
+ <img src="[% ctx.media_prefix %]/images/dash-corner-right1.png" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="common-no-pad"></div>
+</div>
\ No newline at end of file
return $self->load_password_reset if $path =~ m|opac/password_reset|;
return $self->load_logout if $path =~ m|opac/logout|;
return $self->load_patron_reg if $path =~ m|opac/register|;
+ return $self->biblio_load_logout if $path =~ m|opac/biblio/logout|;
$self->load_simple("myopac") if $path =~ m:opac/myopac:; # A default page for myopac parts
}
if($path =~ m|opac/biblio/login|) {
- return $self->load_login unless $self->editor->requestor; # already logged in?
+ return $self->biblio_load_login unless $self->editor->requestor; # already logged in?
# This will be less confusing to users than to be shown a login form
# when they're already logged in.
return $self->generic_redirect(
sprintf(
- "%s://%s%s/myopac/main",
+ "%s://%s%s/biblio/main_fines",
$self->ctx->{proto},
$self->ctx->{hostname}, $self->ctx->{opac_root}
)
# capture some commonly accessed pages
$ctx->{home_page} = $ctx->{proto} . '://' . $ctx->{hostname} . $self->ctx->{opac_root} . "/home";
+ $ctx->{biblio_login_page} = $ctx->{proto} . '://' . $ctx->{hostname} . $self->ctx->{opac_root} . "/biblio/main_fines";
$ctx->{logout_page} = ($ctx->{proto} eq 'http' ? 'https' : $ctx->{proto} ) . '://' . $ctx->{hostname} . $self->ctx->{opac_root} . "/logout";
if($e->authtoken($self->cgi->cookie(COOKIE_SES))) {
}
# -----------------------------------------------------------------------------
+# BiblioCommons E-Commerce Log in and redirect to the redirect_to URL (or home)
+# -----------------------------------------------------------------------------
+sub biblio_load_login {
+ my $self = shift;
+ my $cgi = $self->cgi;
+ my $ctx = $self->ctx;
+
+ $self->timelog("Load login begins");
+
+ $ctx->{page} = 'login';
+
+ my $username = $cgi->param('username');
+ $username =~ s/\s//g; # Remove blanks
+ my $password = $cgi->param('password');
+ my $org_unit = $ctx->{physical_loc} || $ctx->{aou_tree}->()->id;
+ my $persist = $cgi->param('persist');
+
+ # initial log form only
+ return Apache2::Const::OK unless $username and $password;
+
+ my $auth_proxy_enabled = 0; # default false
+ try { # if the service is not running, just let this fail silently
+ $auth_proxy_enabled = $U->simplereq(
+ 'open-ils.auth_proxy',
+ 'open-ils.auth_proxy.enabled');
+ } catch Error with {};
+
+ $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'
+ };
+
+ my $bc_regex = $ctx->{get_org_setting}->($org_unit, 'opac.barcode_regex');
+
+ # To avoid surprises, default to "Barcodes start with digits"
+ $bc_regex = '^\d' unless $bc_regex;
+
+ if ($bc_regex and ($username =~ /$bc_regex/)) {
+ $args->{barcode} = $username;
+ } else {
+ $args->{username} = $username;
+ }
+
+ my $response;
+ if (!$auth_proxy_enabled) {
+ my $seed = $U->simplereq(
+ 'open-ils.auth',
+ 'open-ils.auth.authenticate.init', $username);
+ $args->{password} = md5_hex($seed . md5_hex($password));
+ $response = $U->simplereq(
+ 'open-ils.auth', 'open-ils.auth.authenticate.complete', $args);
+ } else {
+ $args->{password} = $password;
+ $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
+ $ctx->{login_failed_event} = $response;
+ return Apache2::Const::OK;
+ }
+
+ # login succeeded, redirect as necessary
+
+ my $acct = $self->apache->unparsed_uri;
+ $acct =~ s|/login|/biblio/main_fines|;
+
+ # both login-related cookies should expire at the same time
+ my $login_cookie_expires = ($persist) ? CORE::time + $response->{payload}->{authtime} : undef;
+
+ return $self->generic_redirect(
+ $cgi->param('redirect_to') || $acct,
+ [
+ # contains the actual auth token and should be sent only over https
+ $cgi->cookie(
+ -name => COOKIE_SES,
+ -path => '/',
+ -secure => 1,
+ -value => $response->{payload}->{authtoken},
+ -expires => $login_cookie_expires
+ ),
+ # contains only a hint that we are logged in, and is used to
+ # trigger a redirect to https
+ $cgi->cookie(
+ -name => COOKIE_LOGGEDIN,
+ -path => '/',
+ -secure => 0,
+ -value => '1',
+ -expires => $login_cookie_expires
+ )
+ ]
+ );
+}
+
+# -----------------------------------------------------------------------------
# Log out and redirect to the home page
# -----------------------------------------------------------------------------
sub load_logout {
);
}
+# -----------------------------------------------------------------------------
+# BiblioCommons E-Commerce Log out and redirect to the home page
+# -----------------------------------------------------------------------------
+sub biblio_load_logout {
+ my $self = shift;
+ my $redirect_to = shift || $self->cgi->param('redirect_to');
+
+ # If the user was adding anyting to an anonymous cache
+ # while logged in, go ahead and clear it out.
+ $self->clear_anon_cache;
+
+ return $self->generic_redirect(
+ $redirect_to || $self->ctx->{biblio_login_page},
+ [
+ # clear value of and expire both of these login-related cookies
+ $self->cgi->cookie(
+ -name => COOKIE_SES,
+ -path => '/',
+ -value => '',
+ -expires => '-1h'
+ ),
+ $self->cgi->cookie(
+ -name => COOKIE_LOGGEDIN,
+ -path => '/',
+ -value => '',
+ -expires => '-1h'
+ )
+ ]
+ );
+}
+
1;