View | Details | Raw Unified | Return to bug 28787
Collapse All | Expand All

(-)a/C4/Auth.pm (+2 lines)
Lines 1415-1423 sub checkauth { Link Here
1415
    $template->param( OpacPublic => C4::Context->preference("OpacPublic") );
1415
    $template->param( OpacPublic => C4::Context->preference("OpacPublic") );
1416
    $template->param( loginprompt => 1 ) unless $info{'nopermission'};
1416
    $template->param( loginprompt => 1 ) unless $info{'nopermission'};
1417
    if ( $auth_state eq 'additional-auth-needed' ) {
1417
    if ( $auth_state eq 'additional-auth-needed' ) {
1418
        my $patron = Koha::Patrons->find( { userid => $userid } );
1418
        $template->param(
1419
        $template->param(
1419
            TwoFA_prompt => 1,
1420
            TwoFA_prompt => 1,
1420
            invalid_otp_token => $invalid_otp_token,
1421
            invalid_otp_token => $invalid_otp_token,
1422
            notice_email_address => $patron->notice_email_address, # We could also pass logged_in_user if necessary
1421
        );
1423
        );
1422
    }
1424
    }
1423
1425
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt (-15 / +18 lines)
Lines 195-216 Link Here
195
195
196
            $("#send_otp").on("click", function(e){
196
            $("#send_otp").on("click", function(e){
197
                e.preventDefault();
197
                e.preventDefault();
198
                [% UNLESS notice_email_address %]
199
                    alert("Cannot send the notice, you don't have an email address defined.")
200
                [% ELSE %]
198
                $("#email_success").hide();
201
                $("#email_success").hide();
199
                $("#email_error").hide();
202
                $("#email_error").hide();
200
                $.ajax({
203
                    $.ajax({
201
                    url: '/api/v1/auth/otp/token_delivery',
204
                        url: '/api/v1/auth/otp/token_delivery',
202
                    type: 'POST',
205
                        type: 'POST',
203
                    success: function(data){
206
                        success: function(data){
204
                        let message = _("The code has been sent by email, please check your inbox.")
207
                            let message = _("The code has been sent by email, please check your inbox.")
205
                        $("#email_success").show().html(message);
208
                            $("#email_success").show().html(message);
206
                    },
209
                        },
207
                    error: function(data){
210
                        error: function(data){
208
                        let error = data.responseJSON && data.responseJSON.error == "email_not_sent"
211
                            let error = data.responseJSON && data.responseJSON.error == "email_not_sent"
209
                            ? _("Email not sent, maybe you don't have an email address defined?")
212
                                ? _("Email not sent, please contact the Koha administrator")
210
                            : _("Email not sent");
213
                                : _("Something wrong happened, please contact the Koha administrator");
211
                        $("#email_error").show().html(error);
214
                            $("#email_error").show().html(error);
212
                    }
215
                        }
213
                });
216
                    });
217
                [% END %]
214
            });
218
            });
215
        });
219
        });
216
    </script>
220
    </script>
217
- 

Return to bug 28787