Bugzilla – Attachment 65316 Details for
Bug 16892
Add automatic patron registration via OAuth2 login
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16892: Address error checking in comment #47
Bug-16892-Address-error-checking-in-comment-47.patch (text/plain), 4.21 KB, created by
Mark Tompsett
on 2017-07-28 15:53:52 UTC
(
hide
)
Description:
Bug 16892: Address error checking in comment #47
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2017-07-28 15:53:52 UTC
Size:
4.21 KB
patch
obsolete
>From 0a3be2f1adc5929f4bb1ab02ef00a885367d5ab8 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 28 Jul 2017 11:45:20 -0400 >Subject: [PATCH] Bug 16892: Address error checking in comment #47 > >Tweaked logic to include error check for category >and branch being valid. If not, the user is told >about a configuration error to share with the >library. Otherwise, it should proceed as normal. > >TEST PLAN is comment #35 still. >Though include a run with an invalid category >and/or branch code in the two system preferences: >GoogleOpenIDConnectDefaultBranch and/or >GoogleOpenIDConnectDefaultCategory >--- > opac/svc/auth/googleopenidconnect | 38 ++++++++++++++++++++++---------------- > 1 file changed, 22 insertions(+), 16 deletions(-) > >diff --git a/opac/svc/auth/googleopenidconnect b/opac/svc/auth/googleopenidconnect >index c08b3c1..d417d7a 100755 >--- a/opac/svc/auth/googleopenidconnect >+++ b/opac/svc/auth/googleopenidconnect >@@ -181,6 +181,8 @@ elsif ( defined $query->param('code') ) { > . ' .' ); > } > else { >+ my $error_feedback = >+'The email address you are trying to use is not associated with a borrower at this library.'; > my $auto_registration = C4::Context->preference('GoogleOpenIDConnectAutoRegister') // q{0}; > my $borrower = Koha::Patrons->find( { email => $email } ); > if (! $borrower && $auto_registration==1) { >@@ -190,20 +192,26 @@ elsif ( defined $query->param('code') ) { > my $delimiter = $firstname ? q{.} : q{}; > my $userid = $firstname . $delimiter . $surname; > my $categorycode = C4::Context->preference('GoogleOpenIDConnectDefaultCategory') // q{}; >+ my $patron_category = Koha::Patron::Categories->find( $categorycode ); > my $branchcode = C4::Context->preference('GoogleOpenIDConnectDefaultBranch') // q{}; >- my $password = undef; >- my $borrowernumber = C4::Members::AddMember( >- cardnumber => $cardnumber, >- firstname => $firstname, >- surname => $surname, >- email => $email, >- categorycode => $categorycode, >- branchcode => $branchcode, >- userid => $userid, >- password => $password >- ); >- $borrower = Koha::Patrons->find( { >- borrowernumber => $borrowernumber } ); >+ my $library = Koha::Libraries->find( $branchcode ); >+ if (defined $patron_category && defined $library) { >+ my $password = undef; >+ my $borrowernumber = C4::Members::AddMember( >+ cardnumber => $cardnumber, >+ firstname => $firstname, >+ surname => $surname, >+ email => $email, >+ categorycode => $categorycode, >+ branchcode => $branchcode, >+ userid => $userid, >+ password => $password >+ ); >+ $borrower = Koha::Patrons->find( { >+ borrowernumber => $borrowernumber } ); >+ } else { >+ $error_feedback = 'The GoogleOpenIDConnectDefaultBranch or GoogleOpenIDConnectDefaultCategory system preferences are not configured properly. Please contact the library with this error message.'; >+ } > } > my ( $userid, $cookie, $session_id ) = > checkauth( $query, 1, {}, 'opac', $email ); >@@ -214,9 +222,7 @@ elsif ( defined $query->param('code') ) { > ); > } > else { >- loginfailed( $query, >-'The email address you are trying to use is not associated with a borrower at this library.' >- ); >+ loginfailed( $query, $error_feedback ); > } > } > } >-- >2.1.4
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 16892
:
53257
|
53485
|
53488
|
56081
|
57111
|
57112
|
57113
|
58373
|
58374
|
58375
|
61800
|
61801
|
61802
|
61803
|
61804
|
61886
|
61887
|
61888
|
61889
|
63117
|
63118
|
63119
|
63120
| 65316