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

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 890-896 sub checkauth { Link Here
890
            && ( my $otp_token = $query->param('otp_token') ) )
890
            && ( my $otp_token = $query->param('otp_token') ) )
891
        {
891
        {
892
            my $patron    = Koha::Patrons->find( { userid => $userid } );
892
            my $patron    = Koha::Patrons->find( { userid => $userid } );
893
            my $auth      = Koha::Auth::TwoFactorAuth::get_auth( { patron => $patron } );
893
            my $auth      = Koha::Auth::TwoFactorAuth->new( { patron => $patron } );
894
            my $verified = $auth->verify($otp_token);
894
            my $verified = $auth->verify($otp_token);
895
            $auth->clear;
895
            $auth->clear;
896
            if ( $verified ) {
896
            if ( $verified ) {
(-)a/Koha/Auth/TwoFactorAuth.pm (-3 / +3 lines)
Lines 38-45 It's based on Auth::GoogleAuth Link Here
38
38
39
=cut
39
=cut
40
40
41
sub get_auth {
41
sub new {
42
    my ($params) = @_;
42
    my ($class, $params) = @_;
43
    my $patron   = $params->{patron};
43
    my $patron   = $params->{patron};
44
    my $secret   = $params->{secret};
44
    my $secret   = $params->{secret};
45
    my $secret32 = $params->{secret32};
45
    my $secret32 = $params->{secret32};
Lines 52-58 sub get_auth { Link Here
52
    my $key_id = sprintf "%s_%s",
52
    my $key_id = sprintf "%s_%s",
53
      $issuer, ( $patron->email || $patron->userid );
53
      $issuer, ( $patron->email || $patron->userid );
54
54
55
    return Auth::GoogleAuth->new(
55
    return $class->SUPER::new(
56
        {
56
        {
57
            ( $secret   ? ( secret   => $secret )   : () ),
57
            ( $secret   ? ( secret   => $secret )   : () ),
58
            ( $secret32 ? ( secret32 => $secret32 ) : () ),
58
            ( $secret32 ? ( secret32 => $secret32 ) : () ),
(-)a/members/two_factor_auth.pl (-3 / +2 lines)
Lines 48-54 my $op = $cgi->param('op') // ''; Link Here
48
if ( $op eq 'register-2FA' ) {
48
if ( $op eq 'register-2FA' ) {
49
    my $pin_code = $cgi->param('pin_code');
49
    my $pin_code = $cgi->param('pin_code');
50
    my $secret32 = $cgi->param('secret32');
50
    my $secret32 = $cgi->param('secret32');
51
    my $auth     = Koha::Auth::TwoFactorAuth::get_auth(
51
    my $auth     = Koha::Auth::TwoFactorAuth->new(
52
        { patron => $logged_in_user, secret32 => $secret32 } );
52
        { patron => $logged_in_user, secret32 => $secret32 } );
53
53
54
    my $verified = $auth->verify(
54
    my $verified = $auth->verify(
Lines 75-81 if ( $op eq 'register-2FA' ) { Link Here
75
if ( $op eq 'enable-2FA' ) {
75
if ( $op eq 'enable-2FA' ) {
76
76
77
    my $secret = Koha::AuthUtils::generate_salt( 'weak', 16 );
77
    my $secret = Koha::AuthUtils::generate_salt( 'weak', 16 );
78
    my $auth = Koha::Auth::TwoFactorAuth::get_auth(
78
    my $auth = Koha::Auth::TwoFactorAuth->new(
79
        { patron => $logged_in_user, secret => $secret } );
79
        { patron => $logged_in_user, secret => $secret } );
80
80
81
    my $secret32 = $auth->generate_secret32;
81
    my $secret32 = $auth->generate_secret32;
82
- 

Return to bug 28786