Bug 28786: Two-factor authentication for staff client - TOTP
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / auth.tt
index 0baa814..9449424 100644 (file)
@@ -7,13 +7,14 @@
 [% USE Registers %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo;
-    [% IF ( nopermission ) %]Access denied[% END %]
-    [% IF ( timed_out ) %]Session timed out[% END %]
-    [% IF ( different_ip ) %]IP address change[% END %]
+<title>
+    [% IF TwoFA_prompt %]Two-factor authentication[% END %]
+    [% IF ( loginprompt ) %]Log in to Koha[% END %]
     [% IF too_many_login_attempts %]This account has been locked.
     [% ELSIF invalid_username_or_password %]Invalid username or password[% END %]
-    [% IF ( loginprompt ) %]Log in to Koha[% END %]
+    [% IF ( different_ip ) %]IP address change[% END %]
+    [% IF ( timed_out ) %]Session timed out[% END %]
+    [% IF ( nopermission ) %]Access denied[% END %] &rsaquo; Koha
 </title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
@@ -61,7 +62,7 @@
 <p>If you have a shibboleth account, please <a href="[% shibbolethLoginUrl | $raw %]">click here</a> to login.</p>
 [% END %]
 
-[% UNLESS Koha.Preference('staffShibOnly') %]
+[% IF !TwoFA_prompt && !Koha.Preference('staffShibOnly') %]
     <!-- login prompt time-->
     <form action="[% script_name | html %]" method="post" name="loginform" id="loginform">
         <input type="hidden" name="koha_login_context" value="intranet" />
         <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
     [% END %]
     <p><label for="userid">Username:</label>
-    <input type="text" name="userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" />
+    <input type="text" name="userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" autocomplete="off" />
     </p>
     <p><label for="password">Password:</label>
-    <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" />
+    <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" autocomplete="off" />
     </p>
 
     [% UNLESS IndependentBranches %]
 
     <!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
 
-    <p class="submit"><input id="submit-button" type="submit" value="Login" tabindex="4" /></p>
+    <p class="submit"><input id="submit-button" type="submit" value="Log in" tabindex="4" /></p>
     </form>
 
     [% IF ( casAuthentication ) %]
             [% END %]
         [% END %]
     [% END %]
+[% ELSIF TwoFA_prompt %]
+    <form action="[% script_name | html %]" method="post" name="loginform" id="loginform">
+        <input type="hidden" name="koha_login_context" value="intranet" />
+        [% FOREACH INPUT IN INPUTS %]
+            <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
+        [% END %]
+        [% IF invalid_otp_token %]
+            <div class="dialog error">Invalid two-factor code</div>
+        [% END %]
+
+        <p><label for="otp_token">Two-factor authentication code:</label>
+        <input type="text" name="otp_token" id="otp_token" class="input focus" value="" size="20" tabindex="1" />
+        <p class="submit"><input id="submit-button" type="submit" value="Verify code" /></p>
+        <a class="logout" id="logout" href="/cgi-bin/koha/mainpage.pl?logout.x=1">Log out</a>
+
+    </form>
 [% END %]
 
 [% IF ( nopermission ) %]
-    <p><a href="javascript:window.history.back()">[Previous page]</a>
-    <a href="/">[Main page]</a></p>
+    <p><a id="previous_page" href="javascript:window.history.back()">[Previous page]</a>
+    <a id="mainpage" href="/">[Main page]</a></p>
 [% END %]