9 [% PROCESS 'i18n.inc' %]
10 [% SET footerjs = 1 %]
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>[% FILTER collapse %]
14 [% t("Two-factor authentication") | html %] ›
17 [% t("Two-factor authentication setup") | html %] ›
19 [% IF too_many_login_attempts %]
20 [% t("This account has been locked.") | html %] ›
21 [% ELSIF invalid_username_or_password %]
22 [% t("Invalid username or password") | html %] ›
24 [% IF ( different_ip ) %]
25 [% t("IP address change") | html %] ›
27 [% IF ( timed_out ) %]
28 [% t("Session timed out") | html %] ›
30 [% IF ( nopermission ) %]
31 [% t("Access denied") | html %] ›
33 [% IF ( auth_error ) %]
34 [% t("Error authenticating with external provider") | html %] ›
36 [% IF ( loginprompt ) %]
37 [% t("Log in to Koha") | html %] ›
39 [% t("Koha") | html %]
41 [% INCLUDE 'doc-head-close.inc' %]
42 [% PROCESS 'auth-two-factor.inc' %]
44 <body id="main_auth" class="main_main-auth">
46 <div class="main container-fluid">
49 <h1><a href="http://koha-community.org">Koha</a></h1>
50 [% IF (Koha.Preference('StaffLoginInstructions')) %]<div id="login_instructions">[% Koha.Preference('StaffLoginInstructions') | $raw %]</div>[% END %]
51 [% IF ( nopermission ) %]
52 <div id="login_error">
53 <strong>Error:</strong>
54 You do not have permission to access this page.
56 <p><strong>Log in as a different user</strong></p></h2>
59 [% IF ( timed_out ) %]
60 <div id="login_error"><strong>Error: </strong>Session timed out.<br /> Please log in again</div>
63 [% IF ( different_ip ) %]
64 <div id="login_error"><strong>Error: </strong>IP address has changed. Please log in again </div>
68 <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>
71 [% IF too_many_login_attempts %]
72 <div id="login_error"><strong>Error: </strong>This account has been locked!</div>
73 [% IF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
74 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
76 [% ELSIF password_has_expired %]
77 <div id="login_error"><strong>Error: </strong>Your password has expired!</div>
78 [% IF Koha.Preference('EnableExpiredPasswordReset') && Koha.Preference('OpacBaseURL') %]
79 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-reset-password.pl">You must reset your password</a>.
80 [% ELSIF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
81 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
83 <p>You must contact the library to reset your password</p>
85 [% ELSIF invalid_username_or_password %]
86 <div id="login_error"><strong>Error: </strong>Invalid username or password</div>
90 <div id="login_error" class="alert alert-danger">
91 <p>There was an error authenticating to external identity provider</p>
92 <p>[% auth_error | html %]</p>
96 [% IF (shibbolethAuthentication) %]
97 <!-- This is what is displayed if shib login has failed -->
98 [% IF (invalidShibLogin ) %]
99 <div id="login_error"><Strong>Error: </strong>Shibboleth login failed</div>
101 <p><a href="[% shibbolethLoginUrl | $raw %]">Log in using a Shibboleth account</a>.</p>
104 [% IF !TwoFA_prompt && !TwoFA_setup && !Koha.Preference('staffShibOnly') %]
105 <!-- login prompt time-->
106 [% SET identity_providers = AuthClient.get_providers('staff') %]
107 [% IF ( ! identity_providers.empty ) %]
108 [% FOREACH provider IN identity_providers %]
110 <a href="[% provider.url | url %]" class="btn btn-light col-xs-12" id="provider_[% provider.code | html %]">
111 [% IF provider.icon_url %]
112 <img src="[% provider.icon_url | url %]" style="max-height: 20px; max-width: 20px;"/>
114 <i class="fa fa-user" aria-hidden="true"></i>
116 Log in with [% provider.description | html %]
121 <p>If you do not have an external account, but do have a local account, you can still log in: </p>
122 [% END # /IF identity_providers.size %]
124 <form action="[% script_name | html %]" method="post" name="loginform" id="loginform" class="validated">
125 <input type="hidden" name="koha_login_context" value="intranet" />
126 [% FOREACH INPUT IN INPUTS %]
127 <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
129 <p><label for="userid">Username:</label>
130 <input type="text" name="userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" autocomplete="off" />
132 <p><label for="password">Password:</label>
133 <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" autocomplete="off" />
136 [% UNLESS IndependentBranches %]
138 [% IF Koha.Preference('ForceLibrarySelection') %]
139 <label for="branch" class="required">Library:</label>
140 <select name="branch" id="branch" class="input" tabindex="3" required="required">
141 <option value=""></option>
143 <label for="branch">Library:</label>
144 <select name="branch" id="branch" class="input" tabindex="3">
145 <option value="">My library</option>
147 [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
148 <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
151 [% IF Koha.Preference('ForceLibrarySelection') %]
152 <span class="required">Required</span>
156 [% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
158 <label for="desk">Desk:</label>
159 <select name="desk_id" id="desk_id" class="input" tabindex="3">
160 <option id="nodesk" value="">---</option>
161 [% FOREACH d IN Desks.all %]
162 <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled >[% d.desk_name | html %]</option>
168 [% IF Koha.Preference('UseCashRegisters') && Registers.all().size %]
170 <label for="register_id">Cash register:</label>
171 <select name="register_id" id="register_id" class="input" tabindex="4">
172 <option id="noregister" value="" selected="selected">Library default</option>
173 [% PROCESS options_for_registers registers => Registers.all() %]
180 <!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
182 <p class="submit"><input id="submit-button" type="submit" class="btn btn-primary" value="Log in" tabindex="4" /></p>
185 [% IF ( casAuthentication ) %]
188 [% IF ( invalidCasLogin ) %]
189 <!-- This is what is displayed if cas login has failed -->
190 <p>Sorry, the CAS login failed.</p>
193 [% IF ( casServerUrl ) %]
194 <p><a href="[% casServerUrl | $raw %]">If you have a CAS account, please click here to login</a>.<p>
197 [% IF ( casServersLoop ) %]
198 <p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
200 [% FOREACH casServer IN casServersLoop %]
201 <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
205 [% ELSIF TwoFA_prompt %]
206 <form action="[% script_name | html %]" method="post" name="loginform" id="loginform" autocomplete="off">
207 <input type="hidden" name="koha_login_context" value="intranet" />
208 [% FOREACH INPUT IN INPUTS %]
209 <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
211 [% IF invalid_otp_token %]
212 <div id="login_error">Invalid two-factor code</div>
215 <div id="email_error" class="dialog alert" style="display: none;"></div>
216 <div id="email_success" class="dialog message" style="display: none;"></div>
218 <label for="otp_token">Two-factor authentication code:</label>
219 <input type="text" name="otp_token" id="otp_token" class="input focus" value="" size="20" tabindex="1" />
222 <input type="submit" id="submit-button" class="btn btn-primary" value="Verify code" />
223 <a class="send_otp" id="send_otp" href="#">Send the code by email</a>
224 <a class="cancel" id="logout" href="/cgi-bin/koha/mainpage.pl?logout.x=1">Cancel</a>
228 [% ELSIF TwoFA_setup %]
229 [% PROCESS registration_form %]
232 [% IF ( nopermission ) %]
233 <p><a id="previous_page" href="javascript:window.history.back()">[Previous page]</a>
234 <a id="mainpage" href="/">[Main page]</a></p>
239 <!-- <li><a href="/cgi-bin/koha/lostpassword.pl" title="Password lost and found">Lost your password?</a></li> -->
244 [% MACRO jsinclude BLOCK %]
245 [% Asset.js("js/desk_selection.js") | $raw %]
246 [% Asset.js("js/register_selection.js") | $raw %]
248 $(document).ready( function() {
249 if ( document.location.hash ) {
250 $( '#loginform' ).append( '<input name="auth_forwarded_hash" type="hidden" value="' + document.location.hash + '"/>' );
252 // Clear last borrowers, rememberd sql reports, carts, etc.
255 $("#send_otp").on("click", function(e){
257 [% UNLESS notice_email_address %]
258 alert("Cannot send the notice, you don't have an email address defined.")
260 $("#email_success").hide();
261 $("#email_error").hide();
263 url: '/api/v1/auth/otp/token_delivery',
265 success: function(data){
266 let message = _("The code has been sent by email, please check your inbox.")
267 $("#email_success").show().html(message);
269 error: function(data){
270 let error = data.responseJSON && data.responseJSON.error == "email_not_sent"
271 ? _("Email not sent, please contact the Koha administrator")
272 : _("Something wrong happened, please contact the Koha administrator");
273 $("#email_error").show().html(error);
279 if( $("#registration-form").length ) {
283 url: '/api/v1/auth/two-factor/registration',
284 success: function (data) {
285 $("#qr_code").attr('src', data.qr_code);
286 $("#secret32").val(data.secret32);
287 $("#issuer").html(data.issuer);
288 $("#key_id").html(data.key_id);
289 $("#key_secret").html(data.secret32);
290 $("#registration-form").show();
292 error: function (data) {
298 $("#register-2FA").on("click", function(e){
301 secret32: $("#secret32").val(),
302 pin_code: $("#pin_code").val(),
304 if (!data.pin_code) return;
309 url: '/api/v1/auth/two-factor/registration/verification',
310 success: function (data) {
313 error: function (data) {
314 const error = data.responseJSON.error;
315 if ( error == 'Invalid pin' ) {
316 $("#errors").html(_("Invalid PIN code")).show();
322 alert(_("Two-factor authentication correctly configured. You will be redirected to the login screen."));
323 window.location = "/cgi-bin/koha/mainpage.pl";
330 <!-- the main div is closed in intranet-bottom.inc -->
331 [% INCLUDE 'intranet-bottom.inc' %]