# ----------------------------------------------------------------
unless($self->cgi->https and $self->editor->requestor) {
# If a secure resource is requested insecurely, redirect to the login page
- my $url = 'https://' . $self->apache->hostname . $self->ctx->{base_path} . "/opac/login";
+ my $url = 'https://' . $self->apache->hostname . $self->ctx->{opac_root} . "/login";
$self->apache->print($self->cgi->redirect(-url => $url));
return Apache2::Const::REDIRECT;
}
);
};
+ # retrieve and cache org unit setting values
$ctx->{get_org_setting} = sub {
my($org_id, $setting) = @_;
$cache{org_settings}{$org_id} = {} unless $cache{org_settings}{$org_id};
my $ctx = $self->ctx;
$ctx->{referer} = $self->cgi->referer;
+ $ctx->{path_info} = $self->cgi->path_info;
+ $ctx->{opac_root} = $ctx->{base_path} . "/opac"; # absolute base url
$ctx->{is_staff} = ($self->apache->headers_in->get('User-Agent') =~ 'oils_xulrunner');
if($e->authtoken($self->cgi->cookie('ses'))) {
my $org_unit = $cgi->param('loc') || $ctx->{aou_tree}->()->id;
my $persist = $cgi->param('persist');
- # initial log form loading
+ # initial log form only
return Apache2::Const::OK unless $username and $password;
my $seed = $U->simplereq(
sub load_logout {
my $self = shift;
- my $url = 'http://' . $self->apache->hostname . $self->ctx->{base_path} . "/opac/home";
+ my $url = 'http://' . $self->apache->hostname . $self->ctx->{opac_root} . "/home";
$self->apache->print(
$self->cgi->redirect(
my $tt = Template->new({
OUTPUT => ($as_xml) ? sub { parse_as_xml($r, $ctx, @_); } : $r,
INCLUDE_PATH => $ctx->{template_paths},
- DEBUG => $ctx->{debug_template}
+ DEBUG => $ctx->{debug_template},
+ PLUGINS => {EGI18N => 'OpenILS::WWW::EGWeb::I18NFilter'}
});
unless($tt->process($template, {ctx => $ctx, l => set_text_handler($ctx, $r)})) {
$lh_cache{$locale} = $lh_cache{'en_US'};
}
- return sub { return $lh_cache{$locale}->maketext(@_); };
+ return $OpenILS::WWW::EGWeb::I18NFilter::maketext =
+ sub { return $lh_cache{$locale}->maketext(@_); };
}
--- /dev/null
+package OpenILS::WWW::EGWeb::I18NFilter;
+use Template::Plugin::Filter;
+use base qw(Template::Plugin::Filter);
+our $DYNAMIC = 1;
+our $maketext;
+
+sub filter {
+ my ($self, $text, $args) = @_;
+ return $maketext->($text, @$args);
+}
+
+sub init {
+ my $self = shift;
+ $self->install_filter('l');
+ return $self;
+}
+
+1;
+
+[% USE CGI %]
[% WRAPPER "default/opac/parts/base.tt2";
INCLUDE "default/opac/parts/topnav.tt2";
ctx.page_title = "Account Login" %]
-
-
<!-- TODO: MOVE INTO SEPARATE FORGOT-PASSWORD PAGE
+
<div class="hide_me">
<div class='login_text color_1' style='padding: 4px; text-align: center;'>
<span>[% l("Login") %]</span>
^== TODO: MOVE INTO SEPARATE FORGOT-PASSWORD PAGE -->
-
-[% IF ctx.login_failed_event;
+[% IF ctx.login_failed_event %]
+<div id='login-failed-message'>
+[%
IF ctx.login_failed_event.textcode == 'PATRON_CARD_INACTIVE';
l("The barcode used to login is marked as inactive. Please contact your local library.");
ELSIF ctx.login_failed_event.textcode == 'PATRON_INACTIVE';
l("This account has been deactivated. Please contact your local library.");
ELSE;
- l("Login failed. The username or password provided was not valid. Ensure Caps-Lock is off and try again or contact your local library.");
+ l("Login failed. The username or password provided was not valid.
+ Ensure Caps-Lock is off and try again or contact your local library.");
END;
-END %]
-
+%]
+</div>
+[% END %]
<div>
<div style="height:20px;"></div>
width="100%">
<tr>
<td colspan="2" style="padding-bottom: 10px;">
- <h1>Log in to Your Account</h1>
- Please enter the following information:
+ <h1>[% l('Log in to Your Account') %]</h1>
+ [% l('Please enter the following information:') %]
<br /><br />
</td>
</tr>
<td valign="top" class="lbl1">
[% l('PIN Number or Password') %]<br />
<span class="lbl2">
- [% l('If this is your first time logging in, please enter [_1] the last 4 digits of your phone number. [_2] Example: 0926', '<br/>', '<br/>') %]
+ [% | l('<br/>', '<br/>') %]
+ If this is your first time logging in, please enter [_1] the last 4 digits of your phone number. [_2] Example: 0926
+ [% END %]
</span>
</td>
<td valign="top">
<input name="password" type="password" />
</div>
<div style="padding-top:7px;">
- <input type='hidden'
- name='redirect_to'
- value='[% CGI.param('redirect_to') || ctx.referer | replace('^http:', 'https:') %]' />
+ [%
+ # If no redirect is offered or it's leading us back to the
+ # login form, redirect the user to My Account
+ redirect = CGI.param('redirect_to') || ctx.referer;
+ IF !redirect OR redirect.match(ctx.path_info _ '$');
+ redirect = CGI.url('-full' => 1) _ '/opac/myopac/main';
+ END;
+ redirect = redirect | replace('^http:', 'https:');
+ %]
+ <input type='hidden' name='redirect_to' value='[% redirect %]'/>
<input type="checkbox" name="persist" /> [% l('Remember Me?') %]
</div>
<div style="padding-top:14px;">
- <input type='image' alt="Log in" src="[% ctx.media_prefix %]/images/login-btn2.png" />
+ <input type='image' alt="[% l('Log in') %]" src="[% ctx.media_prefix %]/images/login-btn2.png" />
<!-- TODO
<a href="reset_password"
style="position:relative;top:-13px;left:2px;font-size:10px;">Forgot your PIN?</a>
<!-- ****************** top_nav.xml ***************************** -->
+[%
+ USE CGI;
+ USE EGI18N;
+%]
<div id="header">
<div class="float-left"><a
href="http://www.kcls.org"><img alt="KCLS Logo"