Bugzilla – Attachment 163129 Details for
Bug 34164
OAuth2/OIDC should redirect to page that initiated login
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to redirect on login
0001-Redirect-to-the-referring-url-on-login-excluding-log.patch (text/plain), 2.08 KB, created by
Nicholas van Oudtshoorn
on 2024-03-14 04:38:20 UTC
(
hide
)
Description:
Patch to redirect on login
Filename:
MIME Type:
Creator:
Nicholas van Oudtshoorn
Created:
2024-03-14 04:38:20 UTC
Size:
2.08 KB
patch
obsolete
>From f01b485986fb5fb85f653b7d1605d19a033fddbf Mon Sep 17 00:00:00 2001 >From: Nicholas van Oudtshoorn <vanoudt@gmail.com> >Date: Thu, 14 Mar 2024 12:36:09 +0800 >Subject: [PATCH] Redirect to the referring url on login, excluding logout > parameters. Redirect to the main page or user page if the referring url isn't > part of this koah installation. > >--- > opac/cgi-bin/opac/svc/auth/googleopenidconnect | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > >diff --git a/opac/cgi-bin/opac/svc/auth/googleopenidconnect b/opac/cgi-bin/opac/svc/auth/googleopenidconnect >index 5a18c87..ad43f0b 100755 >--- a/opac/cgi-bin/opac/svc/auth/googleopenidconnect >+++ b/opac/cgi-bin/opac/svc/auth/googleopenidconnect >@@ -211,14 +211,19 @@ elsif ( defined $query->param('code') ) { > my ( $userid, $cookie, $session_id ) = > checkauth( $query, 1, {}, 'opac', $email ); > if ($userid) { # A user with this email is registered in koha >- > #handle redirect to main.pl, for private opac > my $uri; >- if (C4::Context->preference('OpacPublic') ) { >+ my $referer = $session->param( 'auth-refer-uri' ); >+ if ( $referer =~ /^$host/ ) { >+ my $regex = qr/logout\.x=1/mp; >+ $uri = $referer =~ s/$regex//rg; >+ } else { >+ if (C4::Context->preference('OpacPublic') ) { > $uri = '/cgi-bin/koha/opac-user.pl'; >- } else { >+ } else { > $uri = '/cgi-bin/koha/opac-main.pl'; >- } >+ } >+ } > print $query->redirect( > -uri => $uri, > -cookie => $cookie >@@ -244,6 +249,7 @@ else { > my $openidstate = 'auth_'; > $openidstate .= sprintf( "%x", rand 16 ) for 1 .. 32; > $session->param( 'google-openid-state', $openidstate ); >+ $session->param( 'auth-refer-uri', $ENV{HTTP_REFERER} ); > $session->flush(); > > my $prompt = $query->param('reauthenticate') // q{}; >-- >2.34.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 34164
:
163127
|
163128
|
163129
|
163493
|
163494
|
163495
|
163496
|
164979
|
164980