Bug 28998: (QA follow-up) Improve output on error
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / two_factor_auth.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE Asset %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Two-factor authentication &rsaquo; Patrons &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9 <body id="pat_two_factor_auth" class="pat">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'patron-search.inc' %]
12
13 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
14     <ol>
15         <li>
16             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
17         </li>
18         <li>
19             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
20         </li>
21         <li>
22             <a href="#" aria-current="page">
23                 Manage two-factor authentication
24             </a>
25         </li>
26     </ol>
27 </nav>
28
29 <div class="main container-fluid">
30     <div class="row">
31         <div class="col-sm-10 col-sm-push-2">
32             <main>
33
34                 [% INCLUDE 'members-toolbar.inc' %]
35
36                 <h1>Manage two-factor authentication</h1>
37
38                 [% IF ( missing_key ) %]
39                     <div id="error_message" class="dialog message">
40                         <p>
41                             Operation cannot proceed, please define an encryption key in your configuration.
42                         </p>
43                     </div>
44                 [% ELSE %]
45
46                     [% IF op == 'register' %]
47                         <div class="dialog message">
48                             <p>We recommend cloud-based mobile authenticator apps such as Authy, Duo Mobile, and LastPass. They can restore access if you lose your hardware device.</p>
49                             <p>Can't scan the code?</p>
50                             <p>To add the entry manually, provide the following details to the application on your phone.</p>
51                             <p>Account: [% issuer | html %]</p>
52                             <p>Key: [% key_id | html %]</p>
53                             <p>Time based: Yes</p>
54                         </div>
55
56                         [% IF invalid_pin %]
57                             <div class="dialog error">Invalid pin code</div>
58                         [% END %]
59                         <form id="two-factor-auth" action="/cgi-bin/koha/members/two_factor_auth.pl" method="post">
60                             <fieldset class="rows">
61                                 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
62                                 <input type="hidden" name="op" value="register-2FA" />
63                                 <input type="hidden" name="secret32" value="[% secret32 | html %]" />
64                                 <ol>
65                                     <li>
66                                         <label for="qr_code">QR code: </label>
67                                         <img id="qr_code" src="[% qr_code | $raw %]" />
68                                     </li>
69                                     <li>
70                                         <label for="pin_code">Pin code: </label>
71                                         <input type="text" id="pin_code" name="pin_code" value="" />
72                                     </li>
73                                 </ol>
74                             </fieldset>
75                             <fieldset class="action">
76                                 <input type="submit" value="Register with two-factor app" />
77                                 <a class="cancel" href="/cgi-bin/koha/members/two_factor_auth.pl">Cancel</a>
78                             </fieldset>
79                         </form>
80                     [% ELSE %]
81                         [% IF patron.auth_method == "two-factor" %]
82                             <div class="two-factor-status">Status: Enabled</div>
83
84                             <form id="two-factor-auth" action="/cgi-bin/koha/members/two_factor_auth.pl" method="post">
85                                 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
86                                 <input type="hidden" name="op" value="disable-2FA" />
87                                 <input type="submit" value="Disable two-factor authentication" />
88                             </form>
89                         [% ELSE %]
90                             <div class="two-factor-status">Status: Disabled</div>
91
92                             <form id="two-factor-auth" action="/cgi-bin/koha/members/two_factor_auth.pl" method="post">
93                                 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
94                                 <input type="hidden" name="op" value="enable-2FA" />
95                                 <input type="submit" value="Enable two-factor authentication" />
96                             </form>
97
98                         [% END %]
99                     [% END %]
100                 [% END %]
101             </main>
102         </div> <!-- /.col-sm-10.col-sm-push-2 -->
103
104         <div class="col-sm-2 col-sm-pull-10">
105             <aside>
106                 [% INCLUDE 'circ-menu.inc' %]
107             </aside>
108         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
109     </div> <!-- /.row -->
110
111
112 [% MACRO jsinclude BLOCK %]
113     [% INCLUDE 'str/members-menu.inc' %]
114     [% Asset.js("js/members-menu.js") | $raw %]
115     <script>
116         $(document).ready(function(){
117             $(".delete").on("click", function(e){
118                 return confirmDelete(_("Are you sure you want to delete this key?"));
119             });
120         });
121     </script>
122 [% END %]
123
124 [% INCLUDE 'intranet-bottom.inc' %]