Bugzilla – Attachment 129538 Details for
Bug 29894
2FA: Add few validations, clear secret, send register notice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29894: Module changes (preliminary)
Bug-29894-Module-changes-preliminary.patch (text/plain), 2.16 KB, created by
Marcel de Rooy
on 2022-01-17 15:29:43 UTC
(
hide
)
Description:
Bug 29894: Module changes (preliminary)
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-01-17 15:29:43 UTC
Size:
2.16 KB
patch
obsolete
>From 4862bd7d31373dd9a79c4d4da655c588f1051caa Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 17 Jan 2022 15:28:46 +0000 >Subject: [PATCH] Bug 29894: Module changes (preliminary) >Content-Type: text/plain; charset=utf-8 > >--- > Koha/Auth/TwoFactorAuth.pm | 30 ++++++++++++++++-------------- > 1 file changed, 16 insertions(+), 14 deletions(-) > >diff --git a/Koha/Auth/TwoFactorAuth.pm b/Koha/Auth/TwoFactorAuth.pm >index 81ddf06a3d..de35166485 100644 >--- a/Koha/Auth/TwoFactorAuth.pm >+++ b/Koha/Auth/TwoFactorAuth.pm >@@ -16,7 +16,8 @@ package Koha::Auth::TwoFactorAuth; > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Auth::GoogleAuth; >+#use Auth::GoogleAuth; >+use Koha::Exceptions; > > use base qw( Auth::GoogleAuth ); > >@@ -40,30 +41,31 @@ It's based on Auth::GoogleAuth > > $obj = Koha::Auth::TwoFactorAuth->new({ patron => $p, secret => $s }); > >+ The patron parameter is mandatory. If no secret is passed, the patron's >+ secret will be used. >+ > =cut > > sub new { > my ($class, $params) = @_; > my $patron = $params->{patron}; >- my $secret = $params->{secret}; >- my $secret32 = $params->{secret32}; >+ Koha::Exceptions::MissingParameter->throw("Mandatory patron parameter missing") >+ unless $patron && ref($patron) eq 'Koha::Patron'; >+ my $secret = $params->{secret} || $patron->secret; >+ Koha::Exceptions::MissingParameter->throw("No secret passed or patron has no secret") >+ unless $secret; > >- if (!$secret && !$secret32){ >- $secret32 = $patron->secret; >- } >+ my $secret_type = $secret =~ /[^a-z2-7]/ ? 'secret' : 'secret32'; > > my $issuer = $patron->library->branchname; > my $key_id = sprintf "%s_%s", > $issuer, ( $patron->email || $patron->userid ); > >- return $class->SUPER::new( >- { >- ( $secret ? ( secret => $secret ) : () ), >- ( $secret32 ? ( secret32 => $secret32 ) : () ), >- issuer => $issuer, >- key_id => $key_id, >- } >- ); >+ return $class->SUPER::new({ >+ $secret_type => $secret, >+ issuer => $issuer, >+ key_id => $key_id, >+ }); > } > > 1; >-- >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 29894
:
129538
|
129539
|
129669
|
129670
|
129689
|
129690
|
129691
|
129692
|
133286
|
133287
|
133288
|
133289
|
133562
|
133563
|
133564
|
133565
|
133566
|
133618
|
133661
|
133662
|
133663
|
133664
|
133665
|
133666
|
133667