Bugzilla – Attachment 133319 Details for
Bug 28998
Encrypt borrowers.secret
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28998: (follow-up) Apply changes to TwoFactorAuth module and script
Bug-28998-follow-up-Apply-changes-to-TwoFactorAuth.patch (text/plain), 4.06 KB, created by
Marcel de Rooy
on 2022-04-14 14:28:44 UTC
(
hide
)
Description:
Bug 28998: (follow-up) Apply changes to TwoFactorAuth module and script
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-04-14 14:28:44 UTC
Size:
4.06 KB
patch
obsolete
>From fb548ac984b16eaf9aed7db62f1365f805a57f60 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 14 Apr 2022 13:24:39 +0000 >Subject: [PATCH] Bug 28998: (follow-up) Apply changes to TwoFactorAuth module > and script >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/db_dependent/Koha/Auth/TwoFactorAuth.t >Walk thru cycle register - logout/login - deregister - logout/login. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Auth/TwoFactorAuth.pm | 2 +- > members/two_factor_auth.pl | 2 +- > t/db_dependent/Koha/Auth/TwoFactorAuth.t | 12 ++++++------ > 3 files changed, 8 insertions(+), 8 deletions(-) > >diff --git a/Koha/Auth/TwoFactorAuth.pm b/Koha/Auth/TwoFactorAuth.pm >index 75288a8f12..5ba5d09e55 100644 >--- a/Koha/Auth/TwoFactorAuth.pm >+++ b/Koha/Auth/TwoFactorAuth.pm >@@ -72,7 +72,7 @@ sub new { > } elsif( $secret ) { > $type = 'secret'; > } elsif( $patron->secret ) { >- $secret32 = $patron->secret; # saved already in base32 >+ $secret32 = $patron->decoded_secret; # saved already in base32 > } else { > Koha::Exceptions::MissingParameter->throw("No secret passed or patron has no secret"); > } >diff --git a/members/two_factor_auth.pl b/members/two_factor_auth.pl >index 6d5847e0ac..cdb714f285 100755 >--- a/members/two_factor_auth.pl >+++ b/members/two_factor_auth.pl >@@ -69,7 +69,7 @@ if ( $op eq 'register-2FA' ) { > > if ($verified) { > # FIXME Generate a (new?) secret >- $logged_in_user->secret($secret32); >+ $logged_in_user->encode_secret($secret32); > $logged_in_user->auth_method('two-factor')->store; > $op = 'registered'; > if( $logged_in_user->notice_email_address ) { >diff --git a/t/db_dependent/Koha/Auth/TwoFactorAuth.t b/t/db_dependent/Koha/Auth/TwoFactorAuth.t >index 4185e5cde0..d4faea1cc0 100755 >--- a/t/db_dependent/Koha/Auth/TwoFactorAuth.t >+++ b/t/db_dependent/Koha/Auth/TwoFactorAuth.t >@@ -42,10 +42,10 @@ subtest 'new' => sub { > 'Croaked on wrong encoding'; > > # Test passing secret or secret32 (converted to base32) >- $patron->secret('nv4v65dpobpxgzldojsxiii'); # this is base32 already for 'my_top_secret!' >+ $patron->encode_secret('nv4v65dpobpxgzldojsxiii'); # this is base32 already for 'my_top_secret!' > my $auth = Koha::Auth::TwoFactorAuth->new({ patron => $patron }); >- is( $auth->secret32, $patron->secret, 'Base32 secret as expected' ); >- $auth->code( $patron->secret ); # trigger conversion by passing base32 to code >+ is( $auth->secret32, $patron->decoded_secret, 'Base32 secret as expected' ); >+ $auth->code( $patron->decoded_secret ); # trigger conversion by passing base32 to code > is( $auth->secret, 'my_top_secret!', 'Decoded secret fine too' ); > # The other way around > $auth = Koha::Auth::TwoFactorAuth->new({ patron => $patron, secret => 'my_top_secret!' }); >@@ -64,7 +64,7 @@ subtest 'qr_code' => sub { > > t::lib::Mocks::mock_preference('TwoFactorAuthentication', 1); > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >- $patron->secret('you2wont2guess2it'); # this is base32 btw >+ $patron->encode_secret('you2wont2guess2it'); # this is base32 btw > $patron->auth_method('two-factor'); > $patron->store; > >@@ -76,7 +76,7 @@ subtest 'qr_code' => sub { > $auth->clear; > > # Changing the secret should generate different data, right? >- $patron->secret('no3really3not3cracked'); # base32 >+ $patron->encode_secret('no3really3not3cracked'); # base32 > $patron->store; > $auth = Koha::Auth::TwoFactorAuth->new({ patron => $patron }); > my $img_data02 = $auth->qr_code; >@@ -92,7 +92,7 @@ subtest 'send_confirm_notice' => sub { > > t::lib::Mocks::mock_preference('TwoFactorAuthentication', 1); > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >- $patron->secret('you2wont2guess2it'); # this is base32 btw >+ $patron->encode_secret('you2wont2guess2it'); # this is base32 btw > $patron->auth_method('two-factor'); > $patron->store; > my $auth = Koha::Auth::TwoFactorAuth->new({ patron => $patron }); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28998
:
124772
|
124773
|
124774
|
133291
|
133317
|
133318
|
133319
|
133320
|
133321
|
133322
|
133323
|
133523
|
133524
|
133525
|
133526
|
133527
|
133528
|
133529
|
133580
|
133581
|
133582
|
133583
|
133584
|
133585
|
133586
|
133588
|
133619
|
133620
|
133621
|
133622
|
133623
|
133624
|
133625
|
133626
|
133627
|
133628
|
133629
|
133631
|
133632
|
133633
|
133634
|
133635
|
133636
|
133637
|
133638
|
133639
|
133640
|
133641
|
133642
|
133645
|
133646
|
133647
|
133648
|
133649
|
133650
|
133651
|
133652
|
133653
|
133654
|
133655
|
134636
|
134637
|
134671