10 [% INCLUDE 'doc-head-open.inc' %]
12 [% IF TwoFA_prompt %]Two-factor authentication[% END %]
13 [% IF TwoFA_setup %]Two-factor authentication setup[% END %]
14 [% IF ( loginprompt ) %]Log in to Koha[% END %]
15 [% IF too_many_login_attempts %]This account has been locked.
16 [% ELSIF invalid_username_or_password %]Invalid username or password[% END %]
17 [% IF ( different_ip ) %]IP address change[% END %]
18 [% IF ( timed_out ) %]Session timed out[% END %]
19 [% IF ( nopermission ) %]Access denied[% END %]
20 [% IF ( auth_error ) %]Error authenticating with external provider[% END %] › Koha
22 [% INCLUDE 'doc-head-close.inc' %]
23 [% PROCESS 'auth-two-factor.inc' %]
25 <body id="main_auth" class="main_main-auth">
27 <div class="main container-fluid">
30 <h1><a href="http://koha-community.org">Koha</a></h1>
31 [% IF (Koha.Preference('StaffLoginInstructions')) %]<div id="login_instructions">[% Koha.Preference('StaffLoginInstructions') | $raw %]</div>[% END %]
32 [% IF ( nopermission ) %]
33 <div id="login_error">
34 <strong>Error:</strong>
35 You do not have permission to access this page.
37 <p><strong>Log in as a different user</strong></p></h2>
40 [% IF ( timed_out ) %]
41 <div id="login_error"><strong>Error: </strong>Session timed out.<br /> Please log in again</div>
44 [% IF ( different_ip ) %]
45 <div id="login_error"><strong>Error: </strong>IP address has changed. Please log in again </div>
49 <div id="login_error"><strong>Error: </strong>Autolocation is switched on and you are logging in with an IP address that doesn't match your library. </div>
52 [% IF too_many_login_attempts %]
53 <div id="login_error"><strong>Error: </strong>This account has been locked!</div>
54 [% IF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
55 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
57 [% ELSIF password_has_expired %]
58 <div id="login_error"><strong>Error: </strong>Your password has expired!</div>
59 [% IF Koha.Preference('EnableExpiredPasswordReset') && Koha.Preference('OpacBaseURL') %]
60 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-reset-password.pl">You must reset your password</a>.
61 [% ELSIF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
62 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
64 <p>You must contact the library to reset your password</p>
66 [% ELSIF invalid_username_or_password %]
67 <div id="login_error"><strong>Error: </strong>Invalid username or password</div>
71 <div id="login_error" class="alert alert-danger">
72 <p>There was an error authenticating to external identity provider</p>
73 <p>[% auth_error | html %]</p>
77 [% IF (shibbolethAuthentication) %]
78 <!-- This is what is displayed if shib login has failed -->
79 [% IF (invalidShibLogin ) %]
80 <div id="login_error"><Strong>Error: </strong>Shibboleth login failed</div>
82 <p><a href="[% shibbolethLoginUrl | $raw %]">Log in using a Shibboleth account</a>.</p>
85 [% IF !TwoFA_prompt && !TwoFA_setup && !Koha.Preference('staffShibOnly') %]
86 <!-- login prompt time-->
87 [% SET identity_providers = AuthClient.get_providers('staff') %]
88 [% IF ( ! identity_providers.empty ) %]
89 [% FOREACH provider IN identity_providers %]
91 <a href="[% provider.url | url %]" class="btn btn-light col-xs-12" id="provider_[% provider.code | html %]">
92 [% IF provider.icon_url %]
93 <img src="[% provider.icon_url | url %]" style="max-height: 20px; max-width: 20px;"/>
95 <i class="fa fa-user" aria-hidden="true"></i>
97 Log in with [% provider.description | html %]
102 <p>If you do not have an external account, but do have a local account, you can still log in: </p>
103 [% END # /IF identity_providers.size %]
105 <form action="[% script_name | html %]" method="post" name="loginform" id="loginform">
106 <input type="hidden" name="koha_login_context" value="intranet" />
107 [% FOREACH INPUT IN INPUTS %]
108 <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
110 <p><label for="userid">Username:</label>
111 <input type="text" name="userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" autocomplete="off" />
113 <p><label for="password">Password:</label>
114 <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" autocomplete="off" />
117 [% UNLESS IndependentBranches %]
119 <label for="branch">Library:</label>
120 <select name="branch" id="branch" class="input" tabindex="3">
121 <option value="">My library</option>
122 [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
123 <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
128 [% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
130 <label for="desk">Desk:</label>
131 <select name="desk_id" id="desk_id" class="input" tabindex="3">
132 <option id="nodesk" value="">---</option>
133 [% FOREACH d IN Desks.all %]
134 <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled >[% d.desk_name | html %]</option>
140 [% IF Koha.Preference('UseCashRegisters') && Registers.all().size %]
142 <label for="register_id">Cash register:</label>
143 <select name="register_id" id="register_id" class="input" tabindex="4">
144 <option id="noregister" value="" selected="selected">Library default</option>
145 [% PROCESS options_for_registers registers => Registers.all() %]
152 <!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
154 <p class="submit"><input id="submit-button" type="submit" class="btn btn-primary" value="Log in" tabindex="4" /></p>
157 [% IF ( casAuthentication ) %]
160 [% IF ( invalidCasLogin ) %]
161 <!-- This is what is displayed if cas login has failed -->
162 <p>Sorry, the CAS login failed.</p>
165 [% IF ( casServerUrl ) %]
166 <p><a href="[% casServerUrl | $raw %]">If you have a CAS account, please click here to login</a>.<p>
169 [% IF ( casServersLoop ) %]
170 <p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
172 [% FOREACH casServer IN casServersLoop %]
173 <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
177 [% ELSIF TwoFA_prompt %]
178 <form action="[% script_name | html %]" method="post" name="loginform" id="loginform" autocomplete="off">
179 <input type="hidden" name="koha_login_context" value="intranet" />
180 [% FOREACH INPUT IN INPUTS %]
181 <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
183 [% IF invalid_otp_token %]
184 <div id="login_error">Invalid two-factor code</div>
187 <div id="email_error" class="dialog alert" style="display: none;"></div>
188 <div id="email_success" class="dialog message" style="display: none;"></div>
190 <label for="otp_token">Two-factor authentication code:</label>
191 <input type="text" name="otp_token" id="otp_token" class="input focus" value="" size="20" tabindex="1" />
194 <input type="submit" id="submit-button" class="btn btn-primary" value="Verify code" />
195 <a class="send_otp" id="send_otp" href="#">Send the code by email</a>
196 <a class="cancel" id="logout" href="/cgi-bin/koha/mainpage.pl?logout.x=1">Cancel</a>
200 [% ELSIF TwoFA_setup %]
201 [% PROCESS registration_form %]
204 [% IF ( nopermission ) %]
205 <p><a id="previous_page" href="javascript:window.history.back()">[Previous page]</a>
206 <a id="mainpage" href="/">[Main page]</a></p>
211 <!-- <li><a href="/cgi-bin/koha/lostpassword.pl" title="Password lost and found">Lost your password?</a></li> -->
216 [% MACRO jsinclude BLOCK %]
217 [% Asset.js("js/desk_selection.js") | $raw %]
218 [% Asset.js("js/register_selection.js") | $raw %]
220 $(document).ready( function() {
221 if ( document.location.hash ) {
222 $( '#loginform' ).append( '<input name="auth_forwarded_hash" type="hidden" value="' + document.location.hash + '"/>' );
224 // Clear last borrowers, rememberd sql reports, carts, etc.
227 $("#send_otp").on("click", function(e){
229 [% UNLESS notice_email_address %]
230 alert("Cannot send the notice, you don't have an email address defined.")
232 $("#email_success").hide();
233 $("#email_error").hide();
235 url: '/api/v1/auth/otp/token_delivery',
237 success: function(data){
238 let message = _("The code has been sent by email, please check your inbox.")
239 $("#email_success").show().html(message);
241 error: function(data){
242 let error = data.responseJSON && data.responseJSON.error == "email_not_sent"
243 ? _("Email not sent, please contact the Koha administrator")
244 : _("Something wrong happened, please contact the Koha administrator");
245 $("#email_error").show().html(error);
251 if( $("#registration-form").length ) {
255 url: '/api/v1/auth/two-factor/registration',
256 success: function (data) {
257 $("#qr_code").attr('src', data.qr_code);
258 $("#secret32").val(data.secret32);
259 $("#issuer").html(data.issuer);
260 $("#key_id").html(data.key_id);
261 $("#registration-form").show();
263 error: function (data) {
269 $("#register-2FA").on("click", function(e){
272 secret32: $("#secret32").val(),
273 pin_code: $("#pin_code").val(),
275 if (!data.pin_code) return;
280 url: '/api/v1/auth/two-factor/registration/verification',
281 success: function (data) {
284 error: function (data) {
285 const error = data.responseJSON.error;
286 if ( error == 'Invalid pin' ) {
287 $("#errors").html(_("Invalid PIN code")).show();
293 alert(_("Two-factor authentication correctly configured. You will be redirected to the login screen."));
294 window.location = "/cgi-bin/koha/mainpage.pl";
301 <!-- the main div is closed in intranet-bottom.inc -->
302 [% INCLUDE 'intranet-bottom.inc' %]