mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-22 04:32:02 +02:00
Redirect to / when /oauth2/sign_in accessed
Without this change, clicking the sign-in button on /oauth2/sign_in will always redirect back to /oauth2/sign_in, essentially creating an infinite loop.
This commit is contained in:
+6
-1
@@ -307,6 +307,11 @@ func (p *OauthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
|
||||
p.ClearCookie(rw, req)
|
||||
rw.WriteHeader(code)
|
||||
|
||||
redirect_url := req.URL.RequestURI()
|
||||
if redirect_url == signInPath {
|
||||
redirect_url = "/"
|
||||
}
|
||||
|
||||
t := struct {
|
||||
ProviderName string
|
||||
SignInMessage string
|
||||
@@ -317,7 +322,7 @@ func (p *OauthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
|
||||
ProviderName: p.provider.Data().ProviderName,
|
||||
SignInMessage: p.SignInMessage,
|
||||
CustomLogin: p.displayCustomLoginForm(),
|
||||
Redirect: req.URL.RequestURI(),
|
||||
Redirect: redirect_url,
|
||||
Version: VERSION,
|
||||
}
|
||||
p.templates.ExecuteTemplate(rw, "sign_in.html", t)
|
||||
|
||||
Reference in New Issue
Block a user