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

(-)a/opac/svc/auth/googleopenidconnect (-17 / +22 lines)
Lines 181-186 elsif ( defined $query->param('code') ) { Link Here
181
                      . ' .' );
181
                      . ' .' );
182
            }
182
            }
183
            else {
183
            else {
184
                my $error_feedback =
185
'The email address you are trying to use is not associated with a borrower at this library.';
184
                my $auto_registration = C4::Context->preference('GoogleOpenIDConnectAutoRegister') // q{0};
186
                my $auto_registration = C4::Context->preference('GoogleOpenIDConnectAutoRegister') // q{0};
185
                my $borrower = Koha::Patrons->find( { email => $email } );
187
                my $borrower = Koha::Patrons->find( { email => $email } );
186
                if (! $borrower && $auto_registration==1) {
188
                if (! $borrower && $auto_registration==1) {
Lines 190-209 elsif ( defined $query->param('code') ) { Link Here
190
                    my $delimiter = $firstname ? q{.} : q{};
192
                    my $delimiter = $firstname ? q{.} : q{};
191
                    my $userid = $firstname . $delimiter . $surname;
193
                    my $userid = $firstname . $delimiter . $surname;
192
                    my $categorycode = C4::Context->preference('GoogleOpenIDConnectDefaultCategory') // q{};
194
                    my $categorycode = C4::Context->preference('GoogleOpenIDConnectDefaultCategory') // q{};
195
                    my $patron_category = Koha::Patron::Categories->find( $categorycode );
193
                    my $branchcode = C4::Context->preference('GoogleOpenIDConnectDefaultBranch') // q{};
196
                    my $branchcode = C4::Context->preference('GoogleOpenIDConnectDefaultBranch') // q{};
194
                    my $password = undef;
197
                    my $library = Koha::Libraries->find( $branchcode );
195
                    my $borrowernumber = C4::Members::AddMember(
198
                    if (defined $patron_category && defined $library) {
196
                        cardnumber   => $cardnumber,
199
                        my $password = undef;
197
                        firstname    => $firstname,
200
                        my $borrowernumber = C4::Members::AddMember(
198
                        surname      => $surname,
201
                            cardnumber   => $cardnumber,
199
                        email        => $email,
202
                            firstname    => $firstname,
200
                        categorycode => $categorycode,
203
                            surname      => $surname,
201
                        branchcode   => $branchcode,
204
                            email        => $email,
202
                        userid       => $userid,
205
                            categorycode => $categorycode,
203
                        password     => $password
206
                            branchcode   => $branchcode,
204
                    );
207
                            userid       => $userid,
205
                    $borrower = Koha::Patrons->find( {
208
                            password     => $password
206
                        borrowernumber => $borrowernumber } );
209
                        );
210
                        $borrower = Koha::Patrons->find( {
211
                            borrowernumber => $borrowernumber } );
212
                    } else {
213
                        $error_feedback = 'The GoogleOpenIDConnectDefaultBranch or GoogleOpenIDConnectDefaultCategory system preferences are not configured properly. Please contact the library with this error message.';
214
                    }
207
                }
215
                }
208
                my ( $userid, $cookie, $session_id ) =
216
                my ( $userid, $cookie, $session_id ) =
209
                  checkauth( $query, 1, {}, 'opac', $email );
217
                  checkauth( $query, 1, {}, 'opac', $email );
Lines 214-222 elsif ( defined $query->param('code') ) { Link Here
214
                    );
222
                    );
215
                }
223
                }
216
                else {
224
                else {
217
                    loginfailed( $query,
225
                    loginfailed( $query, $error_feedback );
218
'The email address you are trying to use is not associated with a borrower at this library.'
219
                    );
220
                }
226
                }
221
            }
227
            }
222
        }
228
        }
223
- 

Return to bug 16892