Bug 28786: Add controller script and template
[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                 [% IF op == 'register' %]
37                     <h1>Register Two-Factor Authenticator</h1>
38                     <div class="dialog message">
39                         <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>
40                         <p>Can't scan the code?</p>
41                         <p>To add the entry manually, provide the following details to the application on your phone.</p>
42                         <p>Account: [% issuer %]</p>
43                         <p>Key: [% key_id %]</p>
44                         <p>Time based: Yes</p>
45                     </div>
46
47                     [% IF invalid_pin %]
48                         <div class="dialog error">Invalid pin code</div>
49                     [% END %]
50                     <form id="two-factor-auth" action="/cgi-bin/koha/members/two_factor_auth.pl" method="post">
51                         <fieldset class="rows">
52                             <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
53                             <input type="hidden" name="op" value="register-2FA" />
54                             <input type="hidden" name="secret32" value="[% secret32 %]" />
55                             <ol>
56                                 <li>
57                                     <label for="qr_code">QR code: </label>
58                                     <img id="qr_code" src="[% qr_code_url %]" />
59                                 </li>
60                                 <li>
61                                     <label for="pin_code">Pin code: </label>
62                                     <input type="text" id="pin_code" name="pin_code" value="" />
63                                 </li>
64                             </ol>
65                         </fieldset>
66                         <fieldset class="action">
67                             <input type="submit" value="Register with two-factor app" />
68                             <a class="cancel" href="/cgi-bin/koha/members/two_factor_auth.pl">Cancel</a>
69                         </fieldset>
70                     </form>
71                 [% ELSE %]
72                     <h1>Two-Factor Authentication</h1>
73                     [% IF patron.auth_method == "two-factor" %]
74                         <div class="two-factor-status">Status: Enabled</div>
75
76                         <form id="two-factor-auth" action="/cgi-bin/koha/members/two_factor_auth.pl" method="post">
77                             <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
78                             <input type="hidden" name="op" value="disable-2FA" />
79                             <input type="submit" value="Disable Two-Factor Authentication" />
80                         </form>
81                     [% ELSE %]
82                         <div class="two-factor-status">Status: Disabled</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="enable-2FA" />
87                             <input type="submit" value="Enable Two-Factor Authentication" />
88                         </form>
89
90                     [% END %]
91                 [% END %]
92             </main>
93         </div> <!-- /.col-sm-10.col-sm-push-2 -->
94
95         <div class="col-sm-2 col-sm-pull-10">
96             <aside>
97                 [% INCLUDE 'circ-menu.inc' %]
98             </aside>
99         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
100     </div> <!-- /.row -->
101
102
103 [% MACRO jsinclude BLOCK %]
104     [% INCLUDE 'str/members-menu.inc' %]
105     [% Asset.js("js/members-menu.js") | $raw %]
106     <script>
107         $(document).ready(function(){
108             $(".delete").on("click", function(e){
109                 return confirmDelete(_("Are you sure you want to delete this key?"));
110             });
111         });
112     </script>
113 [% END %]
114
115 [% INCLUDE 'intranet-bottom.inc' %]