]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/login/form.tt2
LP#1314827: On login, don't allow referer-based redirect to external site
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / login / form.tt2
1 [% IF ctx.login_failed_event %]
2 <div id='login-failed-message'>
3 [%
4     IF ctx.login_failed_event.textcode == 'PATRON_CARD_INACTIVE';
5         l("The barcode used to login is marked as inactive.  Please contact your local library.");
6     ELSIF ctx.login_failed_event.textcode == 'PATRON_INACTIVE';
7         l("This account has been deactivated.  Please contact your local library.");
8     ELSE;
9         l("Login failed. The username or password provided was not valid. " _
10            "Passwords are case-sensitive.  Check your Caps-Lock key and try again or contact your local library.");
11     END;
12 %]
13 </div>
14 [% END %]
15
16 <div id='login-form-box' class='login_boxes left_brain' style='float:left'>
17     <h1>[% l('Log in to Your Account') %]</h1>
18     [% l('Please enter the following information:') %]
19     <form method='post'>
20         <div style="float: left; padding-bottom: 10px; margin-right: 40px;">
21             <label for='username_field' class="lbl1" >[% l('Library Card Number or Username') %]</label>
22             <div class="input_bg">
23                 <input type='text' id="username_field" name="username" autofocus />
24             </div>
25             <div class="lbl2">[% l('Please include leading zeros and no spaces.') %]</div>
26             <div class="lbl2">[% l('Example: 0026626051') %]</div>
27         </div>
28         <div style="float: left;">
29             <label for="password_field" class="lbl1" >[% l('PIN Number or Password') %]</label>
30             <div class="input_bg">
31                 <input id="password_field" name="password" type="password" />
32             </div>
33             [% INCLUDE "opac/parts/login/password_hint.tt2" %]
34             [% IF reset_password %]
35             <a style="font-size: 80%" href='[% mkurl(ctx.opac_root _ '/password_reset', {}, 1) %]'>[% l('Forgot your password?') %]</a>
36             [% END %]
37         </div>
38         <div style="clear: both; padding-top: 15px;">
39         [%
40             redirect = CGI.param('redirect_to');
41             # Don't use referer unless we got here from elsewhere within the TPAC
42             IF !redirect AND ctx.referer.match('^https?://' _ ctx.hostname _ ctx.opac_root);
43                 redirect = ctx.referer;
44             END;
45             # If no redirect is offered or it's leading us back to the
46             # login form, redirect the user to My Account
47             IF !redirect OR redirect.match(ctx.path_info _ '$');
48                 redirect = CGI.url('-full' => 1) _ '/opac/myopac/main';
49             END;
50                 redirect = redirect  | replace('^http:', 'https:');
51             %]
52             <input type='hidden' name='redirect_to' value='[% redirect %]'/>
53             <input type="checkbox" name="persist" id="login_persist" /><label for="login_persist"> [% l('Stay logged in?') %]</label>
54             <input type="submit" value="[% l('Log in') %]" alt="[% l('Log in') %]" class="opac-button" />
55         </div>
56     </form>
57 </div>
58 [% INCLUDE "opac/parts/login/help.tt2" %]