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

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 883-889 sub checkauth { Link Here
883
        {
883
        {
884
            my $patron    = Koha::Patrons->find( { userid => $userid } );
884
            my $patron    = Koha::Patrons->find( { userid => $userid } );
885
            my $auth      = Koha::Auth::TwoFactorAuth->new( { patron => $patron } );
885
            my $auth      = Koha::Auth::TwoFactorAuth->new( { patron => $patron } );
886
            my $verified = $auth->verify($otp_token, 1);
886
            my $verified = $auth->verify($otp_token);
887
            $auth->clear;
887
            $auth->clear;
888
            if ( $verified ) {
888
            if ( $verified ) {
889
                # The token is correct, the user is fully logged in!
889
                # The token is correct, the user is fully logged in!
(-)a/Koha/Auth/TwoFactorAuth.pm (+21 lines)
Lines 19-24 use Modern::Perl; Link Here
19
use GD::Barcode;
19
use GD::Barcode;
20
use MIME::Base64 qw( encode_base64 );
20
use MIME::Base64 qw( encode_base64 );
21
21
22
use C4::Context;
22
use C4::Letters;
23
use C4::Letters;
23
use Koha::Exceptions;
24
use Koha::Exceptions;
24
use Koha::Exceptions::Patron;
25
use Koha::Exceptions::Patron;
Lines 106-109 sub qr_code { Link Here
106
    return "data:image/png;base64,". encode_base64( $data, q{} ); # does not contain newlines
107
    return "data:image/png;base64,". encode_base64( $data, q{} ); # does not contain newlines
107
}
108
}
108
109
110
=head3 verify
111
112
    my $verified = $auth->verify($otp_token);
113
114
    Replacement for Auth::GoogleAuth::verify.
115
    This uses a system wide default for range.
116
117
=cut
118
119
sub verify {
120
    my ( $self, $code, $range, $secret32, $timestamp, $interval ) = @_;
121
    if ( !defined $range ) {
122
        my $mfa_range = C4::Context->config('mfa_range') ? int( C4::Context->config('mfa_range') ) : 1;
123
        if ($mfa_range) {
124
            $range = $mfa_range;
125
        }
126
    }
127
    return $self->SUPER::verify( $code, $range, $secret32, $timestamp, $interval );
128
}
129
109
1;
130
1;
(-)a/Koha/REST/V1/TwoFactorAuth.pm (-1 / +1 lines)
Lines 139-145 sub verification { Link Here
139
139
140
        my $verified = $auth->verify(
140
        my $verified = $auth->verify(
141
            $pin_code,
141
            $pin_code,
142
            1,        # range
142
            undef,    # range (default to 1 or mfa_range in koha-conf.xml)
143
            $secret32,
143
            $secret32,
144
            undef,    # timestamp (defaults to now)
144
            undef,    # timestamp (defaults to now)
145
            30,       # interval (default 30)
145
            30,       # interval (default 30)
(-)a/debian/templates/koha-conf-site.xml.in (+2 lines)
Lines 480-484 __END_SRU_PUBLICSERVER__ Link Here
480
     <!-- Like: <domain><name>hotmail.com</name><belongs_to>outlook.com</belongs_to></domain> -->
480
     <!-- Like: <domain><name>hotmail.com</name><belongs_to>outlook.com</belongs_to></domain> -->
481
 </message_domain_limits>
481
 </message_domain_limits>
482
482
483
 <mfa_range>1</mfa_range><!-- Number of 30 second iterations to allow for MFA code checking -->
484
483
</config>
485
</config>
484
</yazgfs>
486
</yazgfs>
(-)a/etc/koha-conf.xml (-1 / +2 lines)
Lines 291-295 Link Here
291
     <!-- Like: <domain><name>hotmail.com</name><belongs_to>outlook.com</belongs_to></domain> -->
291
     <!-- Like: <domain><name>hotmail.com</name><belongs_to>outlook.com</belongs_to></domain> -->
292
 </message_domain_limits>
292
 </message_domain_limits>
293
293
294
 <mfa_range>1</mfa_range><!-- Number of 30 second iterations to allow for MFA code checking -->
295
294
</config>
296
</config>
295
</yazgfs>
297
</yazgfs>
296
- 

Return to bug 30843