5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Two-factor authentication › Patrons › Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
9 <body id="pat_two_factor_auth" class="pat">
10 [% WRAPPER 'header.inc' %]
11 [% INCLUDE 'patron-search-header.inc' %]
13 [% PROCESS 'auth-two-factor.inc' %]
15 [% WRAPPER 'sub-header.inc' %]
16 [% WRAPPER breadcrumbs %]
17 [% WRAPPER breadcrumb_item %]
18 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
20 [% WRAPPER breadcrumb_item %]
21 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
23 [% WRAPPER breadcrumb_item bc_active= 1 %]
24 <span>Manage two-factor authentication</span>
26 [% END #/ WRAPPER breadcrumbs %]
27 [% END #/ WRAPPER sub-header.inc %]
29 <div class="main container-fluid">
31 <div class="col-sm-10 col-sm-push-2">
34 [% INCLUDE 'members-toolbar.inc' %]
36 <h1>Manage two-factor authentication</h1>
38 [% IF ( missing_key ) %]
39 <div id="error_message" class="dialog message">
41 Operation cannot proceed, please define an encryption key in your configuration.
45 [% PROCESS registration_form %]
47 <div id="registration-status">
48 [% IF patron.auth_method == "two-factor" %]
49 <div id="registration-status-enabled">
51 <div id="registration-status-enabled" style="display: none;">
53 <div class="two-factor-status">Status: Enabled</div>
55 <form id="two-factor-auth" action="/cgi-bin/koha/members/two_factor_auth.pl" method="post">
56 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
57 <input type="hidden" name="op" value="disable-2FA" />
58 <input type="submit" value="Disable two-factor authentication" />
62 [% IF patron.auth_method == "password" %]
63 <div id="registration-status-disabled">
65 <div id="registration-status-disabled" style="display: none;">
67 <div class="two-factor-status">Status: Disabled</div>
68 [% IF Koha.Preference('TwoFactorAuthentication') == 'enforced' %]
69 <div>Two-factor authentication is mandatory to login. If you do not enable now it will be asked at your next login.</div>
72 <input id="enable-2FA" type="submit" value="Enable two-factor authentication" />
77 </div> <!-- /.col-sm-10.col-sm-push-2 -->
79 <div class="col-sm-2 col-sm-pull-10">
81 [% INCLUDE 'circ-menu.inc' %]
83 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
87 [% MACRO jsinclude BLOCK %]
88 [% INCLUDE 'str/members-menu.inc' %]
89 [% Asset.js("js/members-menu.js") | $raw %]
91 $(document).ready(function(){
92 $("#enable-2FA").on("click", function(e){
97 url: '/api/v1/auth/two-factor/registration',
98 success: function (data) {
99 $("#qr_code").attr('src', data.qr_code);
100 $("#secret32").val(data.secret32);
101 $("#issuer").html(data.issuer);
102 $("#key_id").html(data.key_id);
103 $("#registration-form").show();
104 $("#registration-status").hide();
106 error: function (data) {
112 $("#register-2FA").on("click", function(e){
115 secret32: $("#secret32").val(),
116 pin_code: $("#pin_code").val(),
118 if (!data.pin_code) return;
123 url: '/api/v1/auth/two-factor/registration/verification',
124 success: function (data) {
125 window.location = "/cgi-bin/koha/members/two_factor_auth.pl";
127 error: function (data) {
128 const error = data.responseJSON.error;
129 if ( error == 'Invalid pin' ) {
130 $("#errors").html(_("Invalid PIN code")).show();
142 [% INCLUDE 'intranet-bottom.inc' %]