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

(-)a/opac/cgi-bin/opac/svc/auth/googleopenidconnect (-5 / +10 lines)
Lines 211-224 elsif ( defined $query->param('code') ) { Link Here
211
                my ( $userid, $cookie, $session_id ) =
211
                my ( $userid, $cookie, $session_id ) =
212
                  checkauth( $query, 1, {}, 'opac', $email );
212
                  checkauth( $query, 1, {}, 'opac', $email );
213
                if ($userid) {    # A user with this email is registered in koha
213
                if ($userid) {    # A user with this email is registered in koha
214
215
                    #handle redirect to main.pl, for private opac
214
                    #handle redirect to main.pl, for private opac
216
                    my $uri;
215
                    my $uri;
217
                    if (C4::Context->preference('OpacPublic') ) {
216
		    my $referer = $session->param( 'auth-refer-uri' );
217
		    if ( $referer =~ /^$host/ ) {
218
		      my $regex = qr/logout\.x=1/mp;
219
		      $uri = $referer =~ s/$regex//rg;
220
		    } else {
221
                      if (C4::Context->preference('OpacPublic') ) {
218
                        $uri    =  '/cgi-bin/koha/opac-user.pl';
222
                        $uri    =  '/cgi-bin/koha/opac-user.pl';
219
                    } else {
223
                      } else {
220
                        $uri    =  '/cgi-bin/koha/opac-main.pl';
224
                        $uri    =  '/cgi-bin/koha/opac-main.pl';
221
                    }
225
                      }
226
		    }
222
                    print $query->redirect(
227
                    print $query->redirect(
223
                        -uri    => $uri,
228
                        -uri    => $uri,
224
                        -cookie => $cookie
229
                        -cookie => $cookie
Lines 244-249 else { Link Here
244
    my $openidstate = 'auth_';
249
    my $openidstate = 'auth_';
245
    $openidstate .= sprintf( "%x", rand 16 ) for 1 .. 32;
250
    $openidstate .= sprintf( "%x", rand 16 ) for 1 .. 32;
246
    $session->param( 'google-openid-state', $openidstate );
251
    $session->param( 'google-openid-state', $openidstate );
252
    $session->param( 'auth-refer-uri', $ENV{HTTP_REFERER} );
247
    $session->flush();
253
    $session->flush();
248
254
249
    my $prompt = $query->param('reauthenticate') // q{};
255
    my $prompt = $query->param('reauthenticate') // q{};
250
- 

Return to bug 34164