4 [% PROCESS 'i18n.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
8 [% t("Two-factor authentication") | html %] ›
9 [% t("Patrons") | html %] ›
10 [% t("Koha") | html %]
12 [% INCLUDE 'doc-head-close.inc' %]
14 <body id="pat_two_factor_auth" class="pat">
15 [% WRAPPER 'header.inc' %]
16 [% INCLUDE 'patron-search-header.inc' %]
18 [% PROCESS 'auth-two-factor.inc' %]
20 [% WRAPPER 'sub-header.inc' %]
21 [% WRAPPER breadcrumbs %]
22 [% WRAPPER breadcrumb_item %]
23 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
25 [% WRAPPER breadcrumb_item %]
26 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
28 [% WRAPPER breadcrumb_item bc_active= 1 %]
29 <span>Manage two-factor authentication</span>
31 [% END #/ WRAPPER breadcrumbs %]
32 [% END #/ WRAPPER sub-header.inc %]
34 <div class="main container-fluid">
36 <div class="col-sm-10 col-sm-push-2">
39 [% INCLUDE 'members-toolbar.inc' %]
41 <h1>Manage two-factor authentication</h1>
43 [% IF ( missing_key ) %]
44 <div id="error_message" class="dialog message">
46 Operation cannot proceed, please define an encryption key in your configuration.
50 [% PROCESS registration_form %]
52 <div id="registration-status">
53 [% IF patron.auth_method == "two-factor" %]
54 <div id="registration-status-enabled">
56 <div id="registration-status-enabled" style="display: none;">
58 <div class="two-factor-status">Status: Enabled</div>
60 <form id="two-factor-auth" action="/cgi-bin/koha/members/two_factor_auth.pl" method="post">
61 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
62 <input type="hidden" name="op" value="disable-2FA" />
63 <input type="submit" value="Disable two-factor authentication" />
67 [% IF patron.auth_method == "password" %]
68 <div id="registration-status-disabled">
70 <div id="registration-status-disabled" style="display: none;">
72 <div class="two-factor-status">Status: Disabled</div>
73 [% IF Koha.Preference('TwoFactorAuthentication') == 'enforced' %]
74 <div>Two-factor authentication is mandatory to login. If you do not enable now it will be asked at your next login.</div>
77 <input id="enable-2FA" type="submit" value="Enable two-factor authentication" />
82 </div> <!-- /.col-sm-10.col-sm-push-2 -->
84 <div class="col-sm-2 col-sm-pull-10">
86 [% INCLUDE 'circ-menu.inc' %]
88 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
92 [% MACRO jsinclude BLOCK %]
93 [% INCLUDE 'str/members-menu.inc' %]
94 [% Asset.js("js/members-menu.js") | $raw %]
96 $(document).ready(function(){
97 $("#enable-2FA").on("click", function(e){
102 url: '/api/v1/auth/two-factor/registration',
103 success: function (data) {
104 $("#qr_code").attr('src', data.qr_code);
105 $("#secret32").val(data.secret32);
106 $("#issuer").html(data.issuer);
107 $("#key_id").html(data.key_id);
108 $("#key_secret").html(data.secret32);
109 $("#registration-form").show();
110 $("#registration-status").hide();
112 error: function (data) {
118 $("#register-2FA").on("click", function(e){
121 secret32: $("#secret32").val(),
122 pin_code: $("#pin_code").val(),
124 if (!data.pin_code) return;
129 url: '/api/v1/auth/two-factor/registration/verification',
130 success: function (data) {
131 window.location = "/cgi-bin/koha/members/two_factor_auth.pl";
133 error: function (data) {
134 const error = data.responseJSON.error;
135 if ( error == 'Invalid pin' ) {
136 $("#errors").html(_("Invalid PIN code")).show();
148 [% INCLUDE 'intranet-bottom.inc' %]