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">
47 [% INCLUDE 'messages.inc' %]
50 <h1><a href="http://koha-community.org">Koha</a></h1>
51 [% IF (Koha.Preference('StaffLoginInstructions')) %]<div id="login_instructions">[% Koha.Preference('StaffLoginInstructions') | $raw %]</div>[% END %]
52 [% IF ( nopermission ) %]
53 <div id="login_error">
54 <strong>Error:</strong>
55 You do not have permission to access this page.
57 <p><strong>Log in as a different user</strong></p></h2>
60 [% IF ( timed_out ) %]
61 <div id="login_error"><strong>Error: </strong>Session timed out.<br /> Please log in again</div>
64 [% IF ( different_ip ) %]
65 <div id="login_error"><strong>Error: </strong>IP address has changed. Please log in again </div>
69 <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>
72 [% IF too_many_login_attempts %]
73 <div id="login_error"><strong>Error: </strong>This account has been locked!</div>
74 [% IF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
75 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
77 [% ELSIF password_has_expired %]
78 <div id="login_error"><strong>Error: </strong>Your password has expired!</div>
79 [% IF Koha.Preference('EnableExpiredPasswordReset') && Koha.Preference('OpacBaseURL') %]
80 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-reset-password.pl">You must reset your password</a>.
81 [% ELSIF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
82 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password</a>.
84 <p>You must contact the library to reset your password</p>
86 [% ELSIF invalid_username_or_password %]
87 <div id="login_error"><strong>Error: </strong>Invalid username or password</div>
91 <div id="login_error" class="alert alert-danger">
92 <p>There was an error authenticating to external identity provider</p>
93 <p>[% auth_error | html %]</p>
97 [% IF (shibbolethAuthentication) %]
98 <!-- This is what is displayed if shib login has failed -->
99 [% IF (invalidShibLogin ) %]
100 <div id="login_error"><Strong>Error: </strong>Shibboleth login failed</div>
102 <p><a href="[% shibbolethLoginUrl | $raw %]">Log in using a Shibboleth account</a>.</p>
105 [% IF !TwoFA_prompt && !TwoFA_setup && !Koha.Preference('staffShibOnly') %]
106 <!-- login prompt time-->
107 [% SET identity_providers = AuthClient.get_providers('staff') %]
108 [% IF ( ! identity_providers.empty ) %]
109 [% FOREACH provider IN identity_providers %]
111 <a href="[% provider.url | url %]" class="btn btn-light col-xs-12" id="provider_[% provider.code | html %]">
112 [% IF provider.icon_url %]
113 <img src="[% provider.icon_url | url %]" style="max-height: 20px; max-width: 20px;"/>
115 <i class="fa fa-user" aria-hidden="true"></i>
117 Log in with [% provider.description | html %]
122 <p>If you do not have an external account, but do have a local account, you can still log in: </p>
123 [% END # /IF identity_providers.size %]
125 <form action="[% script_name | html %]" method="post" name="loginform" id="loginform" class="validated">
126 <input type="hidden" name="koha_login_context" value="intranet" />
127 [% FOREACH INPUT IN INPUTS %]
128 [% NEXT IF INPUT.name == "koha_login_context" %]
129 [% NEXT IF INPUT.name == "branch" %]
130 <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
132 <p><label for="userid">Username:</label>
133 <input type="text" name="userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" autocomplete="off" />
135 <p><label for="password">Password:</label>
136 <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" autocomplete="off" />
139 [% UNLESS IndependentBranches %]
141 [% IF Koha.Preference('ForceLibrarySelection') %]
142 <label for="branch" class="required">Library:</label>
143 <select name="branch" id="branch" class="input" tabindex="3" required="required">
144 <option value=""></option>
146 <label for="branch">Library:</label>
147 <select name="branch" id="branch" class="input" tabindex="3">
148 <option value="">My library</option>
150 [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
151 <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
154 [% IF Koha.Preference('ForceLibrarySelection') %]
155 <span class="required">Required</span>
159 [% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
161 <label for="desk">Desk:</label>
162 <select name="desk_id" id="desk_id" class="input" tabindex="3">
163 <option id="nodesk" value="">---</option>
164 [% FOREACH d IN Desks.all %]
165 <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled >[% d.desk_name | html %]</option>
171 [% IF Koha.Preference('UseCashRegisters') && Registers.all().size %]
173 <label for="register_id">Cash register:</label>
174 <select name="register_id" id="register_id" class="input" tabindex="4">
175 <option id="noregister" value="" selected="selected">Library default</option>
176 [% PROCESS options_for_registers registers => Registers.all() %]
183 <!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
185 <p class="submit"><input id="submit-button" type="submit" class="btn btn-primary" value="Log in" tabindex="4" /></p>
188 [% IF ( casAuthentication ) %]
191 [% IF ( invalidCasLogin ) %]
192 <!-- This is what is displayed if cas login has failed -->
193 <p>Sorry, the CAS login failed.</p>
196 [% IF ( casServerUrl ) %]
197 <p><a href="[% casServerUrl | $raw %]">If you have a CAS account, please click here to login</a>.<p>
200 [% IF ( casServersLoop ) %]
201 <p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
203 [% FOREACH casServer IN casServersLoop %]
204 <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
208 [% ELSIF TwoFA_prompt %]
209 <form action="[% script_name | html %]" method="post" name="loginform" id="loginform" autocomplete="off">
210 <input type="hidden" name="koha_login_context" value="intranet" />
211 [% FOREACH INPUT IN INPUTS %]
212 <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
214 [% IF invalid_otp_token %]
215 <div id="login_error">Invalid two-factor code</div>
218 <div id="email_error" class="dialog alert" style="display: none;"></div>
219 <div id="email_success" class="dialog message" style="display: none;"></div>
221 <label for="otp_token">Two-factor authentication code:</label>
222 <input type="text" name="otp_token" id="otp_token" class="input focus" value="" size="20" tabindex="1" />
225 <input type="submit" id="submit-button" class="btn btn-primary" value="Verify code" />
226 <a class="send_otp" id="send_otp" href="#">Send the code by email</a>
227 <a class="cancel" id="logout" href="/cgi-bin/koha/mainpage.pl?logout.x=1">Cancel</a>
231 [% ELSIF TwoFA_setup %]
232 [% PROCESS registration_form %]
235 [% IF ( nopermission ) %]
236 <p><a id="previous_page" href="javascript:window.history.back()">[Previous page]</a>
237 <a id="mainpage" href="/">[Main page]</a></p>
242 <!-- <li><a href="/cgi-bin/koha/lostpassword.pl" title="Password lost and found">Lost your password?</a></li> -->
247 [% MACRO jsinclude BLOCK %]
248 [% Asset.js("js/desk_selection.js") | $raw %]
249 [% Asset.js("js/register_selection.js") | $raw %]
251 $(document).ready( function() {
252 if ( document.location.hash ) {
253 $( '#loginform' ).append( '<input name="auth_forwarded_hash" type="hidden" value="' + document.location.hash + '"/>' );
255 // Clear last borrowers, rememberd sql reports, carts, etc.
258 $("#send_otp").on("click", function(e){
260 [% UNLESS notice_email_address %]
261 alert("Cannot send the notice, you don't have an email address defined.")
263 $("#email_success").hide();
264 $("#email_error").hide();
266 url: '/api/v1/auth/otp/token_delivery',
268 success: function(data){
269 let message = _("The code has been sent by email, please check your inbox.")
270 $("#email_success").show().html(message);
272 error: function(data){
273 let error = data.responseJSON && data.responseJSON.error == "email_not_sent"
274 ? _("Email not sent, please contact the Koha administrator")
275 : _("Something wrong happened, please contact the Koha administrator");
276 $("#email_error").show().html(error);
282 if( $("#registration-form").length ) {
286 url: '/api/v1/auth/two-factor/registration',
287 success: function (data) {
288 $("#qr_code").attr('src', data.qr_code);
289 $("#secret32").val(data.secret32);
290 $("#issuer").html(data.issuer);
291 $("#key_id").html(data.key_id);
292 $("#key_secret").html(data.secret32);
293 $("#registration-form").show();
295 error: function (data) {
301 $("#register-2FA").on("click", function(e){
304 secret32: $("#secret32").val(),
305 pin_code: $("#pin_code").val(),
307 if (!data.pin_code) return;
312 url: '/api/v1/auth/two-factor/registration/verification',
313 success: function (data) {
316 error: function (data) {
317 const error = data.responseJSON.error;
318 if ( error == 'Invalid pin' ) {
319 $("#errors").html(_("Invalid PIN code")).show();
325 alert(_("Two-factor authentication correctly configured. You will be redirected to the login screen."));
326 window.location = "/cgi-bin/koha/mainpage.pl";
333 <!-- the main div is closed in intranet-bottom.inc -->
334 [% INCLUDE 'intranet-bottom.inc' %]