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

(-)a/Koha/Auth/TwoFactorAuth.pm (-4 / +2 lines)
Lines 29-38 Koha::Auth::TwoFactorAuth- Koha class deal with Two factor authentication Link Here
29
use Koha::Auth::TwoFactorAuth;
29
use Koha::Auth::TwoFactorAuth;
30
30
31
my $secret = Koha::AuthUtils::generate_salt( 'weak', 16 );
31
my $secret = Koha::AuthUtils::generate_salt( 'weak', 16 );
32
my $auth = Koha::Auth::TwoFactorAuth->new(
32
my $auth = Koha::Auth::TwoFactorAuth->new({ patron => $patron, secret => $secret });
33
    { patron => $patron, secret => $secret } );
33
my $ok = $auth->verify( $pin_code, 1 );
34
my $secret32 = $auth->generate_secret32;
35
my $ok = $auth->verify($pin_code, 1, $secret32);
36
34
37
It's based on Auth::GoogleAuth
35
It's based on Auth::GoogleAuth
38
36
(-)a/members/two_factor_auth.pl (-4 / +2 lines)
Lines 78-91 if ( $op eq 'enable-2FA' ) { Link Here
78
    my $auth = Koha::Auth::TwoFactorAuth->new(
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;
82
    my $qr_code_url =
81
    my $qr_code_url =
83
      $auth->qr_code( $secret32, $auth->key_id, $auth->issuer, );
82
      $auth->qr_code( undef, $auth->key_id, $auth->issuer ); # no need to pass secret32
84
83
85
    $template->param(
84
    $template->param(
86
        issuer      => $auth->issuer,
85
        issuer      => $auth->issuer,
87
        key_id      => $auth->key_id,
86
        key_id      => $auth->key_id,
88
        secret32    => $secret32,
87
        secret32    => $auth->secret32,
89
        qr_code_url => $qr_code_url,
88
        qr_code_url => $qr_code_url,
90
    );
89
    );
91
    $auth->clear;
90
    $auth->clear;
92
- 

Return to bug 28786